#import "pagePlay.h" @implementation pagePlay @synthesize players=_players; @synthesize questions=_questions; @synthesize dropdownlSelected=_dropdownlSelected; @synthesize pickerView=_pickerView; - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{ if(self.dropdownlSelected == 1) return 4; else return 50; } - (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { if(self.dropdownlSelected == 1) return [NSString stringWithFormat:@"%i",row]; else return [NSString stringWithFormat:@"%i",row]; } - (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSLog(@"Selected: %i", row); [UIView beginAnimations: nil context: NULL]; [UIView setAnimationDuration: 0.25]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; [self.pickerView setFrame: CGRectMake(0,480,320,216)]; [UIView commitAnimations]; } -(IBAction)selectPlayers:(id)sender { self.dropdownlSelected = 1; [UIView beginAnimations: nil context: NULL]; [UIView setAnimationDuration: 0.25]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; [self.pickerView setFrame: CGRectMake(0,264,320,216)]; [UIView commitAnimations]; } -(IBAction)selectQuestions:(id)sender { self.dropdownlSelected = 2; [UIView beginAnimations: nil context: NULL]; [UIView setAnimationDuration: 0.25]; [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; [self.pickerView setFrame: CGRectMake(0,264,320,216)]; [UIView commitAnimations]; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (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. } #pragma mark - View lifecycle - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } @end