views:

68

answers:

1

Hi-- I'm working my way through the book Head First iPhone Development (O'Reilly). Am having trouble on page 68 with the following method and function; I get the error "redefinition of ViewController pickerView:titleForRow:forComponent error. Have checked the code for spaces; seems to be OK. Can you check the code and tell me what's wrong? Thank you.

-(NSString *)pickerView:(UIPickerView *)pickerView 
        titleForRow:(NSInteger)row forComponent: (NSInteger)component{
switch (component) {
    case 0:
        return [activities objectAtIndex:row];
    case 1:
        return [feelings objectAtIndex:row];
}
return nil;

}

+1  A: 

This means that somewhere else in your class, this method is defined. Check your entire class for other definitions of the method

Jacob Relkin
Thanks, just found that I had accidentally re-entered it twice and missed it the second time. My bad! Removed second instance, and it worked. Thanks!
pdenlinger
You're welcome. Can you upvote/accept? Thanks.
Jacob Relkin