你如何将一个变量传递给
我有一个变量,我想在警报视图代理中使用。它仅在显示
UIAlertView
代理?我有一个变量,我想在警报视图代理中使用。它仅在显示
UIAlertView
和UIAlertView
代理的函数中使用,因此我认为它不应该是控制器的属性。是否有一种方法可以将变量附加到UIAlertView
并在代理中检索它?- (void) someUserCondition:(SOCode *)userCode {
if ([userCode warrentsConfirmation] > 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Are you sure?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil];
[alert setAlertViewStyle:UIAlertViewStyleDefault];
//TODO somehow store the code variable on the alert view
[alert show];
}
}
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if ([title isEqualToString:@"OK"]){
SOCode *userCode = //TODO somehow get the code from the alert view
[self continueWithCode:code];
}
}