Search This Blog

Monday, September 13, 2010

pickerView creation

#pragma mark -
#pragma mark Picker View Methods

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {

return 2;
}

- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {

return [arrayColors count];
}

- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {

return [arrayColors objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

if(component == 0)
NSLog(@"Selected Colors: %@ component :%i Index of selected color: %i", [arrayColors objectAtIndex:row],component, row);
else
NSLog(@"Selected Colors: %@ component :%i Index of selected color: %i", [arrayColors objectAtIndex:row],component, row);
}

No comments:

Post a Comment