Basically, I'm creating a custom UIPicker object that contains the array of objects to select from, and use a callback to identify when the selector item has been chosen, and the dialog box is to be removed from the screen.
What I'm trying to do is:
CODE
- (void)loadView {
NSArray *array = [NSArray initWithObjects: @"Test 1", @"Test 2", nil];
CustomPicker *picker = [[CustomPicker alloc] initWithArray:array];
[picker actionSelected:@selector(selectedFirstPicker:)];
}
- (void)selectedFirstPicker:(id)sender {
NSLog(@"Picker selected! Congradulations.\n");
}
NSArray *array = [NSArray initWithObjects: @"Test 1", @"Test 2", nil];
CustomPicker *picker = [[CustomPicker alloc] initWithArray:array];
[picker actionSelected:@selector(selectedFirstPicker:)];
}
- (void)selectedFirstPicker:(id)sender {
NSLog(@"Picker selected! Congradulations.\n");
}
I can *set* the object inside my interface by saying:
CODE
@interface CustomPicker : UIPickerViewDelegate {
SEL onClick;
}
SEL onClick;
}
And when I try calling the "onClick" object, it blows up in my face:
CODE
- (void)actionSelected:(SEL)object {
onClick = object;
}
- (void)callClick {
[self performSelector:onClick withObject:self];
}
onClick = object;
}
- (void)callClick {
[self performSelector:onClick withObject:self];
}
But the SDK doesn't like that, it dies on objc_send.
Does anyone have a working example of this? Or can anyone tell me what I'm doing wrong? Maybe I need to create the "onClick" object as a property, and synthesize it in the class?
I looked over the docs from Apple and they're technically very vague. Not sure what I am doing wrong.