У меня есть приложение, так что оно имеет экран аутентификации в качестве его первого вида. если аутентификация прошла успешно, загружается контроллер tabbar. Все представления на панели вкладок требуют от пользователя ввода пин-кода. Что мне нужно сделать, так это то, что когда пользователь вводит неверный пароль 5 раз, появляется всплывающее окно предупреждения, и приложение возвращается на экран проверки подлинности. Я могу удалить tabbarcontroller.view из супервизора. Но после этого экран пуст. Экран проверки подлинности не отображается. Что я могу сделать для достижения своей задачи?Сброс к первому виду Приложение ios
EDIT:
- (void) alertView:(UIAlertView *) actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (actionSheet == alertDeActivate) {
if (buttonIndex == 0) {
NSLog(@"Alert Deactivated");
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
if (!window) {
window = [[UIApplication sharedApplication].windows objectAtIndex:0];
}
[self.tabBarController.view performSelectorOnMainThread:@selector(removeFromSuperview) withObject:self waitUntilDone:YES];
[self.dataLayer notifySplashRemoved];
}
}
}
-(void)notifySplashRemoved
{
bool userAuthenticated = [self checkForUserAuthentication];
bool appAcivated = [self checkForAppActivation];
if (userAuthenticated)
{
if(appAcivated == false){
self.activationScreen = [[ActivationScreen alloc] init];
[self.activationScreen setdataLayer:self];
[self.window addSubview:self.activationScreen.view];
}
else
{
_tbc = [[UITabBarController alloc] init];
manageVRNs = [[ManageVehiclesView alloc] init];
aboutUsView = [[AboutUsView alloc] init];
helpView = [[HelpView alloc] init];
optionsView = [[OptionsView alloc] init];
_manage = [[UINavigationController alloc] initWithRootViewController:manageVRNs];
[_manage.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigation_bar.png"] forBarMetrics:UIBarMetricsDefault];
_about = [[UINavigationController alloc] initWithRootViewController:aboutUsView];
[_about setNavigationBarHidden:YES];
_help = [[UINavigationController alloc] initWithRootViewController:helpView];
[_help.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigation_bar.png"] forBarMetrics:UIBarMetricsDefault];
self.navCon = [[UINavigationController alloc] initWithRootViewController:optionsView];
[self setnavigationCon:self.navCon];
[optionsView setdataLayer:self];
if ([navCon.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
UIImage *image = [UIImage imageNamed:@"navigation_bar.png"];
[self.navCon.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
[optionsView addSelfView:window];
}
_tbc.viewControllers = [NSArray arrayWithObjects:navCon, _manage, _about, _help, nil];
[_tbc.tabBar setBackgroundImage:[UIImage imageNamed:@"menu_bg.png"]];
[_tbc.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"menu_selected.png"]];
[window addSubview:_tbc.view];
}
}
else
{
self.authenticationScreen = [[AuthenticationScreen alloc] init];
[self.authenticationScreen setdataLayer:self];
[self.window addSubview:self.authenticationScreen.view];
}
}
Опубликуйте некоторый код о том, как вы удаляете 'tabbarcontroller' и добавляете экран проверки подлинности. –
см. Редактирование. dataLayer - это класс NSObject –