我想从appdelegate设置初始viewcontroller.我找到了一个非常好的答案,但它是在Objective C中,我很难在swift中实现同样的功能.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *viewController = // determine the initial view controller here and instantiate it with [storyboard instantiateViewControllerWithIdentifier:<storyboard id>];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
有人能帮忙吗?
我希望初始Viewcontroller依赖于使用条件语句满足的某些条件.
我读到了关于另一个用户遇到类似错误的 SO ,但是这个错误是在不同的情况下.
我最初添加View Controller时收到此消息:
Unbalanced calls to begin/end appearance transitions for
<UITabBarController: 0x197870>
Run Code Online (Sandbox Code Playgroud)
该应用程序的结构如下:
我有一个5个标签的TabBarController链接到5个视图控制器.在初始显示选项卡中,我调出一个新的视图控制器来覆盖作为应用程序的介绍.
我使用此代码调用介绍视图控制器:
IntroVC *vc = [[IntroVC alloc] init];
[self presentModalViewController:vc animated:YES];
[vc release];
Run Code Online (Sandbox Code Playgroud)
此IntroVC视图控制器出现后,显示上述错误.
ps我正在使用xCode 4.2和iOS 5.0 SDK,开发iOS 4.3应用程序.
我已经开始使用Swift和故事板在Xcode上开发iOS应用程序了.我有一个要求,点击按钮,我将在屏幕上显示用户的Facebook个人资料信息(仅当用户使用Facebook登录时),但如果他没有登录,它将自动进入登录屏幕并成功登录再次显示配置文件视图.
我怎样才能做到这一点?