Как вы передаете переменную делегату UIAlertView?

Как вы передаете переменнуюUIAlertView делегировать?

У меня есть переменная, которую я хочу использовать в делегате представления предупреждений. Он используется только в функции, которая показываетUIAlertView иUIAlertView делегат, так что я не думаю, что это должно быть свойство на контроллере. Есть ли способ присоединить переменную кUIAlertView и получить его в делегате?

<code>- (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];
    }                                 
}
</code>

Ответы на вопрос(6)

Ваш ответ на вопрос