Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在els上推送到viewController的if语句不工作_Iphone_Objective C_Ios_If Statement - Fatal编程技术网

Iphone 在els上推送到viewController的if语句不工作

Iphone 在els上推送到viewController的if语句不工作,iphone,objective-c,ios,if-statement,Iphone,Objective C,Ios,If Statement,我在这里做了一个if语句,如果textfield包含少于4个符号,它会弹出一个窗口。如果文本字段包含的内容超过4,则应将其推送到其他viewcontroller UINavigationController *navCon = [UINavigationController alloc] initWithRootViewController:yourViewController]; 由于某种原因,推动不起作用。弹出窗口工作正常 基本上,我们现在使用的viewcontroller是一个“首次启动

我在这里做了一个if语句,如果textfield包含少于4个符号,它会弹出一个窗口。如果文本字段包含的内容超过4,则应将其推送到其他viewcontroller

UINavigationController *navCon = [UINavigationController alloc] initWithRootViewController:yourViewController];
由于某种原因,推动不起作用。弹出窗口工作正常

基本上,我们现在使用的viewcontroller是一个“首次启动设置页面”,所以我不希望用户导航回它。我该怎么做

这是我的密码:

-(IBAction)initialButton:(id)sender {
    NSLog(@"initialButton clicked");

     if([userEmail.text length] <4)
     {
         [WCAlertView showAlertWithTitle:@"Email is empty" message:@"You haven't entered an email yet. Please enter one so we can /sent you the shipping labels."     customizationBlock:^(WCAlertView *alertView) {
             alertView.style = WCAlertViewStyleBlackHatched;
         } completionBlock:^(NSUInteger buttonIndex, WCAlertView *alertView) {
             if (buttonIndex == 0) {
                 NSLog(@"Cancel");
             } else {
                 NSLog(@"Ok");
             }
         } cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
     }
     else {
              ViewController *viewController = [[ViewController alloc] init];
              [self.navigationController pushViewController:viewController animated:YES];
     }
}
-(iAction)初始按钮:(id)发送者{
NSLog(@“单击初始按钮”);

如果([userEmail.text length]您的视图控制器嵌入到导航控制器中?(如果不是
self.navigationController
nil

如果没有,则需要使用视图控制器初始化UINavigationController

UINavigationController *navCon = [UINavigationController alloc] initWithRootViewController:yourViewController];

然后将其设置为窗口的rootViewController。

是否尝试推送绑定到XIB的viewController?如果是这样,则需要使用:viewController*viewController=[[viewController alloc]initWithNibName:@“myXIBName”捆绑包:nil];啊,等等,navigationcontroller正在创建导航栏。基本上,我们现在使用的viewcontroller是“首次启动设置页面”,因此我不希望用户导航回该页面。如何操作?您可以从导航栏中删除左“后退”按钮。使用此transitionController修复该问题:
UINavigationController *navCon = [UINavigationController alloc] initWithRootViewController:yourViewController];