我想在iOS应用程序中执行类似的操作。
我alredy有一个启动画面和一个登录界面,在Splashviewcontroller之后它会显示LoginViewcontroller。
我正在检查ViewDidload
内部的一些条件,并且在特定情况下我想推送到另一个viewcontroller。这适用于ios 5和6,但在ios 7中,当此条件为真时,不会加载。
这是我的代码
-(void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.navigationController.navigationBar.hidden=YES;
mutArrLoggedUsrarray=[[NSMutableArray alloc]init];
newuser=[NEWLoginUSER sharedManager];
nws=[NEWWebservice sharedManager];
alertObject=[AlertsString sharedManager];
alert=[CreateProgressAlert sharedManager];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *strLogStatus=[defaults objectForKey:@"LOGWAY"];
if ([strLogStatus isEqualToString:@"EMAIL"]) {
phoneLiginView.hidden=YES;
emailLoginView.hidden=NO;
isCurrentViewPhone=NO;
KeychainItemWrapper *keychainItemPHONE = [[KeychainItemWrapper alloc] initWithIdentifier:@"PHONENO" accessGroup:nil];
NSString *userTypedEmail=[keychainItemPHONE objectForKey:(__bridge id)(kSecAttrAccount)];
NSString *userTypedPassword=[keychainItemPHONE objectForKey:(__bridge id)(kSecValueData)];
newuser.strEmail=userTypedEmail;
TxtEmail.text=newuser.strEmail;
// [changeBoxbtn setTitle:@"LOGIN WITH PHONE NUMBER" forState:UIControlStateNormal];
changeBoxbtn.hidden=YES;
}
else if([strLogStatus isEqualToString:@"PHONE"])
{
txtUsrname.text=[newuser.strPhoneNum stringByReplacingOccurrencesOfString:@"+94" withString:@""];
isCurrentViewPhone=YES;
//[changeBoxbtn setTitle:@"LOGIN WITH EMAIL ID" forState:UIControlStateNormal];
changeBoxbtn.hidden=YES;
}
else{
isCurrentViewPhone=YES;
RegisterViewController *regvieww=[[RegisterViewController alloc] initWithNibName:@"RegisterViewController" bundle:nil];
[regvieww.view addSubview:regvieww.viewVerify];
[regvieww.view addSubview:regvieww.viewTop];
[regvieww.view addSubview:regvieww.regViaEmailView];
[regvieww.view addSubview:regvieww.selectorView];
[self.navigationController pushViewController:regvieww animated:YES];
}
originalCenter=self.view.center;
if ([UIScreen mainScreen].bounds.size.height==480) {
originalCenter.y=240;
}
}
你能告诉我这有什么问题吗?以及如何解决这个问题
答案 0 :(得分:0)
尝试在方法中将条件移至AppDelegate: didFinishLaunching
并相应地设置第一个viewController。
您也可以尝试将代码从viewDidLoad移动到viewWillAppear。
在viewDidLoad中推送动画的viewController将无效。