2016-10-10 4 views
-1

을 해제하는 방법, I는 다음 문제를 http://joxi.ru/DrlOO41i4WBNMA내가 uialertviewcontroller 내부 메서드를 호출 할 때 AlertViewController

를 얻을.
모든 아이디어 - 매우 감사하겠습니다. 여기

[[WashappService sharedInstance] auth:^(BOOL value) { 
     if(value==TRUE){ 
      [self presentViewController:[LoginController authConfirmScreen:self toUser:user toPhone:szPhone success:^{ 

       [(MenuClientController*)self.menuContainerViewController.leftMenuViewController updateData]; 

       User* user = [User new]; 
       user = [UserPreference get:KEY_CLIENT]; 
       user.typeOwner = self.isWashAdmin; 
       [UserPreference save:KEY_CLIENT toValue:user]; 
       [[WashappService sharedInstance] updateToken:user.token]; 

       self.nStatusLogin = 1; 
       if (self.isWashAdmin){ 
        OOrdersViewController *vMain = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:@"OOrdersViewController"]; 
        [self.navigationController pushViewController:vMain animated:YES]; 
       }else{ 
        CMainViewController *vMain = [[UIStoryboard storyboardWithName:@"Main" bundle:NULL] instantiateViewControllerWithIdentifier:@"CMainView"]; 

        [self.navigationController pushViewController:vMain animated:YES]; 
       } 


      }] animated:YES completion:nil]; 


     } else { 
      [TSMessage showNotificationWithTitle:NSLocalizedString(@"Error", @"Ошибка") 
             subtitle:NSLocalizedString(@"Login failed", @"Не удалось авторизоваться") 
              type:TSMessageNotificationTypeError]; 

     } 
    } toPhone:szPhone toOwnerType:self.isWashAdmin]; 
+0

경고 컨트롤러? –

+0

아래 게시물의 코드 –

답변

0

UIAlertViewController

의 코드

+ (UIAlertController *) authConfirmScreen : (UIViewController에 *) 루트 TOUSER : (사용자 *) 사용자 toPhone : (있는 NSString *) 전화 성공 : (무효 (^)()) 콜백 { __block UITextField * fieldCode = nil;

UIAlertController* alertConfirm=[LoginController alert:NSLocalizedString(@"Confirmation", @"Подтверждение") toMsg:NSLocalizedString(@"Enter the verification code", @"Введите проверочный код") toActionTitle:NSLocalizedString(@"Send", @"Отправить") toAction:^(UIAlertAction *action) { 
    [[WashappService sharedInstance] authConfirm:^(BOOL value, User *userNew) { 

     if (value) { 
      [alertConfirm.view removeFromSuperview]; 
      [user apply:userNew]; 
      user.ownernotifications = [NSNumber numberWithInt:OWNER_RECEIVEALWAYS]; 
      [UserPreference save:KEY_CLIENT toValue:user]; 
      [[WashappService sharedInstance] saveDeviceToken:user]; 


      [[WashappService sharedInstance] getFilters:^(BOOL value, Filters *filterNew) { 
       if (value) { 
        Filters* filters = [Filters new]; 
        [filters apply:filterNew]; 
        [UserPreference save:KEY_FILTERS toValue:filters]; 
       } 
      } ]; 

      callback(); 

     } else { 
      [LoginController msgError:root toAction:^(UIViewController *parentIn) { 
       UIAlertController* test= [LoginController authConfirmScreen:parentIn toUser:user toPhone:phone success:callback]; 
       [parentIn presentViewController:test animated:YES completion:nil]; 
      }]; 

     } 
    } toPhone:phone toCode:fieldCode.text]; 
} toTextField:^(UITextField *textField) { 
    fieldCode=textField; 
    textField.keyboardType=UIKeyboardTypeNumberPad; 
    [textField setTintColor:[@"3f3b47" representedColor] ]; 
} toCancelTitle:NSLocalizedString(@"Cancel", @"Отмена")]; 

return alertConfirm; 

}