tags:

views:

58

answers:

0
Hi.  I am trying to create an iphone app that has a pickerview, 

and when a pickerview option is selected, it plays the appropriate video file..

I have used various codes to populate a pickerview with an array,

and various examples to play a video, however I can't figure out how to combine the two. (I'm a little new...or a lot new)

This is my .h file for the picker view that I'm using.    

I was trying to put the code to play the video in the "if else" loop about halfway down, but I couldn't get it to work.
Any help would be greatly appreciated.

Thanks


//
//  uipickerviewtestViewController.m
//  uipickerviewtest
//
//  Created by Mark Haugh on 7/15/10.
//  Copyright __MyCompanyName__ 2010. All rights reserved.


#import "uipickerviewtestViewController.h"
#import "PlayVideoViewController.h"
#import <MediaPlayer/MediaPlayer.h>

@implementation uipickerviewtestViewController
@synthesize myPicker;





- (NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent: (NSInteger)component
{
    return [pickerArray count];
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return [pickerArray objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger) row inComponent:(NSInteger)component
{
    if ([[pickerArray objectAtIndex:row] isEqual:@"I am #1"]) {







    }
    else if ([[pickerArray objectAtIndex:row] isEqual:@"I am #2"]) {
        NSLog(@"2");
    }
    else if ([[pickerArray objectAtIndex:row] isEqual:@"I am #3"]) {
        NSLog(@"3");
    }
    else if ([[pickerArray objectAtIndex:row] isEqual:@"I am #4"]) {
        NSLog(@"4");
    }
    else if ([[pickerArray objectAtIndex:row] isEqual:@"I am #5"]) {
        NSLog(@"5");
    }
}



// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

    pickerArray = [[NSMutableArray alloc] init];
    [pickerArray addObject:@"I am #1"];
    [pickerArray addObject:@"I am #2"];
    [pickerArray addObject:@"I am #3"];
    [pickerArray addObject:@"I am #4"];
    [pickerArray addObject:@"I am #5"];



    [super viewDidLoad];
}



- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end