Sunday, June 27, 2010

Picker View Methods

#pragma mark -
#pragma mark UIPickerViewDelegate methods

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

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
UIMyViewController *myViewController = [[UIMyViewController alloc] initWithNibName:@"MyView" bundle:nil];
[self.navigationController pushViewController:myViewController animated:YES];
[myViewController release];
}

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return /*no of Components (Partitions of Picker)*/;
}

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

No comments:

Post a Comment