繁体   English   中英

情节提要UITabBarController

[英]Storyboard UITabBarController

我正在尝试使用情节提要构建用于iPhone的应用程序,该情节提要从登录屏幕开始,并且用户触摸登录按钮后,应该使用身份验证方法对其进行检查。 但是,我无法直接将登录按钮链接到UITabBarController,因为当用户触摸该按钮时,它会直接进入“标签栏”页面,而无需检查登录方法。 我也尝试创建从UITabBarController扩展的mytabBar类,并将自定义类中的UITabBarController设置为情节提要中的mytabBar。 然后我放入了登录视图控制器类;

#import "tabBar.h" 
- (IBAction)loginCheck:(id)sender{

    tabBar *tabbar = [[tabBar alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:tabbar animated:YES];
}

但它仍然无法正常工作。

tabBar是什么类型? 此方法没有check 也许做:

//...
NSLog(@"Log");
//...

...在方法中确保它被调用。

每当使用UIStoryboard您都在执行类似的操作,而不是初始化tabBar的新实例:

- (void)showModalAssistantViewController
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; //Put your right Storyboard Name here
tabBar *viewController = [storyboard instantiateViewControllerWithIdentifier:@"TabBarController"]; //Put your right identifier here
[viewController setModalPresentationStyle:UIModalPresentationFullScreen];
[viewController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self.navigationController presentModalViewController:viewController animated:YES];
}

...标识符可以在IB的ViewController's Inspector-Tab中找到。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM