Hi,
I'm trying show an alert view when a button was pressed, so I wrote code as follows:
- (IBAction)signUpComplete: (id)sender {
UIAlertView* alert_view = [[UIAlertView alloc]
initWithTitle: @"test" message: @"test" delegate: nil cancelButtonTitle: @"cancel" otherButtonTitles: @"OK"];
[alert_view show];
[alert_view release];
}
But this code crashes with the following exception in the initWithTitle method:
2010-08-11 03:03:18.697 Polaris[1155:207] *** -[UIButton copyWithZone:]: unrecognized selector sent to instance 0x176af0
2010-08-11 03:03:18.700 Polaris[1155:207] *** Terminating app due to uncaught exception
0x176af0 is the same as the value of the argument 'sender', which is the button whose action handler is signUpComplete:. I think the problem is the otherButtonTitles: parameter, because it works fine with the argument nil. So it has a problem with creating the OK button.
Is there anything wrong with my code?
Thanks!