不确定我是否正确地用了这个问题。有没有办法让 UIAlertView 中选择的按钮索引返回到启动 UIAlertView 的方法?
所以
- (void) someMethod {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Confirm Adding Product" message:Blah, blah, blah" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Yes", @"No", nil];
[alert show];
//some more code - I'd like to get the button index returned here!
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
//anyway to return this to the method above?
if (buttonIndex == 0) {
}
}