XCode 7:启动屏幕可能无法设置自定义类名 [英] XCode 7: Launch screens may not set custom classnames

查看:533
本文介绍了XCode 7:启动屏幕可能无法设置自定义类名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Xcode 7 Beta 2创建了一个简单的应用程序。该应用程序只包含类 MyAppDelegate MyViewController MyMain.storyBoard MyLaunchScreen.storyboard 。使用Xcode 7 Beta 4重新编译应用程序后,将出现启动屏幕可能未设置自定义类名错误。有什么建议?

I created a simple application using Xcode 7 Beta 2. The application simply contains class MyAppDelegate, MyViewController, MyMain.storyBoard and MyLaunchScreen.storyboard. After recompiling the application with Xcode 7 Beta 4 the error "Launch screens may not set custom classnames" appears. Any suggestions?

推荐答案

请注意,启动屏幕不是完全可自定义的视图控制器。您无法在故事板中指定自定义类名,并希望系统通过调用viewDidLoad为您提供在此阶段执行代码的选项。请记住,该应用尚未推出。

Note that the launch screen is not a fully customizable view controller. You cannot specify a custom class name in the storyboard and expect the system to give you the option to execute code at this stage by calling viewDidLoad. Remember, the app hasn’t launched yet.

启动屏幕限制


  • 系统在启动应用程序之前加载启动屏幕文件,这会对其包含的内容产生一些限制(其中一些可能会强制您回到静态图像文件):

  • 应用程序尚未加载,因此视图层次结构不存在,系统无法调用您在应用程序中可能具有的任何自定义视图控制器设置代码(例如viewDidLoad)

  • 您可以只使用标准的UIKit类,因此您可以使用UIView或UIViewController,但不能使用自定义子类。如果您尝试设置自定义类,您将在Xcode中收到非法配置错误。

  • 启动屏幕文件只能使用基本的UIKit视图,例如UIImageView和UILabel。您无法使用UIWebView。

  • 如果您使用的是故事板,则可以指定多个视图控制器,但还有一些限制。例如,您可以在导航或标签栏控制器中嵌入视图控制器,但更复杂的容器类(如UISplitViewController)不起作用(至少尚未使用)。

  • 本地化启动屏幕文件不目前似乎有任何影响。始终使用基本本地化,因此您可能希望避免在启动屏幕上显示文本。

  • 您无法为iPad和iPhone指定不同的启动屏幕文件。如果你对这些设备有明显不同的接口,这可能是一个问题,因为只有你可以用自动布局和大小类这么多。

  • The system loads the launch screen file before launching the app which creates some constraints on what it can contain (some of which may force you back to static image files):
  • The app is not yet loaded so the view hierarchy does not exist and the system can not call any custom view controller setup code you may have in the app (e.g. viewDidLoad)
  • You can only use standard UIKit classes so you can use UIView or UIViewController but not a custom subclass. If you try to set a custom class you will get an Illegal Configuration error in Xcode.
  • The launch screen file can only use basic UIKit views such as UIImageView and UILabel. You cannot use a UIWebView.
  • If you are using a storyboard you can specify multiple view controllers but there are again some limitations. For example you can embed view controllers in a navigation or tab bar controller but more complex container classes such as UISplitViewController do not work (at least not yet).
  • Localizing the launch screen file does not currently seem to have any effect. The base localization is always used so you will probably want to avoid text on the launch screen.
  • You cannot specify different launch screen files for iPad and iPhone. This may be a problem if you have significantly different interfaces for those devices as there is only so much you can do with auto layout and size classes.

如果要部署到iOS 7,您仍需要包含静态启动图像文件。您可以包括启动屏幕文件和静态启动图像。运行iOS 8的iPhone 6等设备将使用启动屏幕文件,而iOS 7设备将回退到启动图像。

If you are deploying to iOS 7 you will still need to include the static launch image files. You can include both a launch screen file and static launch images. Devices such as the iPhone 6 running iOS 8 will use the launch screen file whilst iOS 7 devices will fallback to the launch images.

有关详细信息,请单击>

For more details please click here

这篇关于XCode 7:启动屏幕可能无法设置自定义类名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆