- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经看到这两个被大量使用,但我找不到区别是什么:
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
那么将 bundle 设置为 nil
或 NSBundle.mainBundle()
有什么区别?
最佳答案
其实这两者没有区别。无论您指定 nil
还是 NSBundle.mainBundle()
都将引用主包。
The bundle containing the storyboard file and its related resources. If you specify nil, this method looks in the main bundle of the current application.
引用:UIStoryboard Class Reference
bundle:
参数将在您需要从除 mainBundle()
之外的另一个包访问信息时变得有用。例如,许多第三方库都附带了自己的包,用于打包该特定库使用的资源。因此,如果您想访问这些资源,您需要引用该 bundle 。
关于ios - UIStoryboard() 中的 nil 和 NSBundle 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33398308/
想要在两个 UIStoryBoard 和不同的 UIViewController 之间导航。我的问题是,当我点击 UIButton 时,控件应该从当前 UIStoryBoard 转移到 UIViewC
我有一个 iOS 应用程序,它使用 UIStoryboard 来控制其流程。我希望在 UIStoryboard 中定义我的所有 View 以共享一个共同的背景。有没有一种方法可以做到这一点,而不必为每
我有两个相关的小问题,我认为第二个是因为第一个。 第一个是我的应用程序中有几个 UIButton,但没有文本,只有背景图像。 这些图像已本地化为 6 种语言。 问题是,在 Storyboard中编辑
我使用本教程来实现我的自定义 UITabBarController:link 但我使用的是 Storyboard而不是 xibs。所以一些方法使用下面的代码: NSArray *nibObjects
我有一个主容器 Controller ,用于初始化 subview Controller 。 我正在尝试学习使用 UIStoryboards,但我对如何摆脱 Storyboard感到困惑。 流程如下:
我正在像这样用 MainStoryBoard 编写程序。我有带有 5 个选项卡的 UITabBarController。在每个uiviewcontroller的viewdidload中,我是这样设置的
我正在尝试快速创建 Storyboard扩展,以便更安全地实例化 View Controller protocol IdentifierType { typealias Identifier
有没有一种简单的方法可以在 Storyboard中截取场景/uiviewcontroller 的屏幕截图?我知道您可以从模拟器截取屏幕截图,但我想从 Storyboard中截取图片并将图片发布到 st
将 Controller 添加到 Storyboard时,它们会随机显示在 Storyboard侧边栏列表中。有没有办法将 Controller 重新排序为首选顺序? 这是问题的截图: 最佳答案 我建
我在我的应用程序中使用 UISegue 在我的应用程序中的 View Controller 之间自动转换。我称它们为 A 和 B。 它按预期工作,但是当我想从 B 返回 A 时,我尝试调用[self.
我有一个 AnimalViewController。它是一个基本 View Controller 。我在 UIStoryBoard 中也有 AnimalViewController 场景。 我有一个关
如何识别 UIStoryboard? 该类具有创建和实例化的方法,但我没有看到带有类似name 的@property。例如 获取 Storyboard对象 + storyboardWithName:b
我有这行代码: [UIStoryboard storyboardWithName:(NSString *) bundle (NSBundle *)]; 和 Storyboard文件。我实际上在哪里插入
使用 Storyboard一段时间后,我发现它们非常有用,但是它们确实有一些限制,或者至少是不自然的做事方式。虽然看起来应该为您的应用程序使用单个 Storyboard,但当您获得一个中等大小的应用程
我想知道是否可以在 Storyboard 中分配“动态”颜色。 从 iOS7 开始,您可以使用 tintColor 并通过 keyWindow 的 tintColor 以编程方式更改它。但是我找不到一
我已经使用 Xcode 4.5 开发了应用程序。并在此应用程序中使用 UIStoryboard。 在这个应用程序中,我从一个 ViewController 推送到第二个 ViewController,
我有这段代码,每次我使用它时,目标 View 的 viewDidLoad 都会被调用两次。 为什么会这样? Destination *myDestination = [self.storyboard
我有一个名为 BaseController 的基本 UIViewController,它是通过我的 storyboard 中的 segue 调用的。现在我有这个 baseController 的两个子
AppDelegate 基本上是 UIApplication 的委托(delegate),意味着它将处理应用级别的东西。 但是对于 storyboard appdelegate 无法正常工作,如图所示
我在一个国际化的 Xcode 项目中工作,它有两个 UIStoryboard 文件 en.lproj/Main.storyboard 和 nl.lproj/Main.storyboard。 这样做的结
我是一名优秀的程序员,十分优秀!