【问题标题】:Storyboard -> XIB | Loading Views故事板-> XIB |加载视图
【发布时间】:2012-08-12 08:35:36
【问题描述】:

我最近从 Storyboard 转换为 XIB。因为我有大量的视图,并且通过 git 存储库使用 XIB 更容易。 (该应用现在也可用于 iOS 4)。

现在这是我以前拥有的代码,但我想知道如果没有 Storyboard,但使用 XIB,我将如何实现相同的目标:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle bundleForClass:[self class]]];
infoView *infoViewController = [storyboard instantiateViewControllerWithIdentifier:[defaults objectForKey:@"launchScreen"]];
infoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:infoViewController animated:YES completion:nil];

【问题讨论】:

    标签: objective-c ios xcode storyboard xib


    【解决方案1】:

    首先,您应该将 infoView 从 Storyboard 转换为 infoView.xib ,然后:

        infoView *infoViewController = [[infoView alloc]initWithNibName:@"infoView" bundle:nil];
        infoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        [self presentViewController:infoViewController animated:YES completion:nil];
    

    【讨论】:

      猜你喜欢
      • 2013-08-04
      • 2012-01-30
      • 1970-01-01
      • 2016-11-26
      • 1970-01-01
      • 1970-01-01
      • 2013-02-03
      • 2012-02-29
      • 1970-01-01
      相关资源
      最近更新 更多