应用程序如何访问用于其启动屏幕的XIB或故事板? XIB不在主包中(例如:NSBundle.mainBundle().pathsForResourcesOfType(nil,inDirectory:“”)).这是特别意外的,因为“启动Screen.xib”列在“复制包资源”构建阶段,但没有在包中显示ip,因此
Xcode必须专门处理它.
@R_502_323@
由于Xib不在主包中,获取路径返回nil,但是你可以在没有路径使用方法的帮助下获得启动屏幕的XIB
- let launchScreenNib = UINib(nibName: "LaunchScreen",bundle: nil)
要么
您可以从XIB加载get视图
- // Swift
- let objects = NSBundle.mainBundle().loadNibNamed("LaunchScreen",owner: self,options: nil)
- let view = objects[0] as UIView
- // Obj C
- NSArray *objects = [[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil];
- UIView *view = [objects objectAtIndex:0];