Код: Выделить всё
- (void)dismissAnyAlertControllerIfPresent {
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIViewController *topVC = keyWindow.rootViewController.presentedViewController;
while (topVC.presentedViewController != nil) {
topVC = topVC.presentedViewController;
}
if ([topVC isKindOfClass:[UIAlertController class]]) {
[topVC dismissViewControllerAnimated:NO completion:nil];
}
}
- (void)didLogout {
[self dismissAnyAlertControllerIfPresent];
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs removeObjectForKey:@"userName"];
[prefs synchronize];
// Redirect to login page
[self redirectToLoginPage];
}
- (void)redirectToLoginPage {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
BmobileViewController * login = [storyboard instantiateViewControllerWithIdentifier:@"login"] ;
login.hideBackbtn = YES;
login.hideAutoLogoutMsg = YES;
login.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:login animated:YES completion:nil];
}
else
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil];
BmobileViewController * login = [storyboard instantiateViewControllerWithIdentifier:@"login"] ;
login.hideBackbtn = YES;
login.hideAutoLogoutMsg = YES;
login.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:login animated:YES completion:nil];
}
}
Код: Выделить всё
if ([topVC isKindOfClass:[UIAlertController class]]) {
[topVC dismissViewControllerAnimated:NO completion:nil];
}
Я не могу щелкать текстовые поля на экране входа в систему.
Вопросы: Я прокомментировал код, который идет для экрана входа в систему, и просто проверил, что предупреждение закрыто. Оповещение закрывается на текущей странице, а также текущая страница перестает отвечать на запросы.
Я новичок в разработке IOS, поэтому просто дайте мне совет, как справиться с этой ошибкой, и заранее спасибо
Подробнее здесь: https://stackoverflow.com/questions/790 ... onsive-ios
Мобильная версия