@ Interface demo4ViewController: UIViewController{
}
- (IBAction) myclick: (id) sender;
. M code below
- (IBAction) myclick: (id) sender
{
UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "title" message: @ "message" delegate: self cancelButtonTitle: @ "ok" otherButtonTitles: @ "option 1", @ "option2", nil];
[Alert show];
}
- (Void) alertView: (UIAlertView *) alertView buttonAtIndex: (NSInteger) buttonIndex {
NSLog ([NSString stringWithFormat: @ "% d", buttonIndex]);
}
Why does the console output after running things?? Simply can not get into alertView methods. How to do?
Reply:
You can pop up a warning box, but after a warning box button to select sister responded ..
Reply:
- (Void) alertView: (UIAlertView *) alertView buttonAtIndex: (NSInteger) buttonIndex {
NSLog ([NSString stringWithFormat: @ "% d", buttonIndex]);
}
That there is only one log output. . . What you want to react
Reply:
Find a problem,
(Void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) buttonIndex
Seemingly method must be called this name
Reply:
Oh, it must. This is UIAlertViewDelegate protocol method, you only need to implement.
No comments:
Post a Comment