I am trying to show a warning when a button was pressed, so I wrote the 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] ** * Application termination due to an uncaught exception
0x176af0 is the same as the value of the 'sender' argument, which is the button whose handler is signUpComplete :. I think the problem is with the otherButtonTitles: parameter, because it works fine with the nil argument. Therefore, the problem with creating the OK button. Is there something wrong with my code?
Thank!
source
share