故事板更改未在 iPhone 模拟器中更新

Storyboard changes not updating in iPhone Simulator

我遇到这个问题好几天了,一直没解决..

我完成了 iPhone 5 的故事板,现在我已经为 iPhone 6 创建了一个新的故事板,我从 [=44= 的故事板复制了各种 ViewController ] 5 我做了一些修改。

现在我 运行 我的应用程序在 iPhone 6 模拟器上并且 没有变化 我所做的是可见的!

我附上一些截图:

例如,我将 UICollectionView 的背景颜色更改为蓝色,但这是结果:

我尝试重置模拟器,删除DerivedData文件夹,重启Xcode,删除Storyboard 6并重新添加,我不知道还能尝试什么,我从来没有遇到过这种情况问题

我试过 Xcode 6.4,现在我升级到 Xcode 7 但问题仍然存在...

编辑:

在 AppDelegate 中,我以这种方式获取正确的故事板:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

 _storyboard = [self grabStoryboard];

 //login-registrati view
lvc = (LoginController *)[_storyboard instantiateViewControllerWithIdentifier:@"login"];

tabbarController = (UITabBarController *)self.window.rootViewController;

if (isLogged == YES) {

    self.window.rootViewController = tabbarController;

}
else {

    self.window.rootViewController = lvc;
}

[self.window makeKeyAndVisible];

...
}

- (UIStoryboard *)grabStoryboard {

int screenHeight = [UIScreen mainScreen].bounds.size.height;
UIStoryboard *storyboard;

switch (screenHeight) {

        // iPhone 4s
    case 480:
        storyboard = [UIStoryboard storyboardWithName:@"Main3.5" bundle:nil];
        break;

        // iPhone 5s
    case 568:
        storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        break;

        // iPhone 6
    case 667:
        storyboard = [UIStoryboard storyboardWithName:@"Main6" bundle:nil];
        break;

        // iPhone 6 Plus
    case 736:
        storyboard = [UIStoryboard storyboardWithName:@"Main6+" bundle:nil];
        break;
}

return storyboard;
}

我知道模拟器得到正确的情节提要是在某些 ViewController 中我可以看到更改,但是如果我更改与 UITabbarController 相关的 ViewController 是根视图控制器,那里模拟器上没有变化...

尝试为 UIViewController 创建 属性:

@property (strong, nonatomic) UIViewController *initialViewController;

并在获得新故事板参考后执行此操作:

_storyboard = [self grabStoryboard];
self.initialViewController = [_storyboard instantiateInitialViewController];

然后更改您的根视图

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = self.initialViewController;
[self.window makeKeyAndVisible];

编辑:

我什至试过你的方法。它有效 too.Please 确保您已在 xcode 中设置视图控制器标识符并且它匹配 "login"

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
lvc = (LoginController *)[_storyboard instantiateViewControllerWithIdentifier:@"login"];
 self.window.rootViewController = lvc;
 [self.window makeKeyAndVisible];

来自文档:

实例化InitialViewController

Instantiates and returns the initial view controller in the view controller graph.

Typically, you use this method only when transitioning to the initial view controller in a different storyboard file.

编辑伊拉里奥:

我接受了你的回答,因为它让我朝着正确的方向前进,我解决了这个问题:

tabbarController = (UITabbarController *)[_storyboard instantiateInitialViewController];