相关疑难解决方法(0)

在appdelegate中设置初始viewcontroller - swift

我想从appdelegate设置初始viewcontroller.我找到了一个非常好的答案,但它是在Objective C中,我很难在swift中实现同样的功能.

使用Storyboard以编程方式设置初始视图控制器

- (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依赖于使用条件语句满足的某些条件.

ios

133
推荐指数
13
解决办法
15万
查看次数

iOS 7 - Failing to instantiate default view controller

I am using Xcode 5 in a newly created app and when I just create it I go for the run button e click on it, then the project gets built but it does not show in the iOS Simulator and I get the following message:

 Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - 
 perhaps the designated entry point is not set?
Run Code Online (Sandbox Code Playgroud)

I've Googled about it of course and everybody points out that this is happening because …

iphone xcode objective-c ios xcode5

90
推荐指数
9
解决办法
11万
查看次数

iOS13 on Xcode 11 Black screen even after adding SceneDelegate and updating Info.plist

I am currently getting a blank screen with Xcode 11, Target iOS 13.0 (the app works fine with all below versions iOS 12.1 till 12.4), I want to make my App work for both iOS users above 12.1 and also 13.0 currently getting blank screen despite adding the below SceneDelegate to my existing project and AppManifest

adding App Manifest file

import UIKit
    import SwiftUI

    @available(iOS 13.0, *)
    class SceneDelegate: UIResponder, UIWindowSceneDelegate {

        var window: UIWindow?

        func scene(_ scene: UIScene, willConnectTo session: …
Run Code Online (Sandbox Code Playgroud)

xcode ios appdelegate swift ios13

4
推荐指数
4
解决办法
3139
查看次数

如何设置初始故事板

我有两个故事板,其中一个默认名为Main,另一个我刚刚添加的名为Admin.

Main用于客户,Admin用于应用程序的所有者.

我想知道如何以编程方式设置初始/主界面故事板.

在此输入图像描述

PS我知道如何通过xcode更改它,但不知道编程.

xcode objective-c ios xcode-storyboard

3
推荐指数
2
解决办法
4982
查看次数