访问 UIViewcontroller.traitCollection 编译但使我的应用程序崩溃 [英] Accessing UIViewcontroller.traitCollection compiles but crashes my app

查看:22
本文介绍了访问 UIViewcontroller.traitCollection 编译但使我的应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的故事板是在 xcode6 中构建的,并且正在使用新的基于约束的布局.我的应用程序以两种配置运行,wRegular hRegular 和 wCompact hAny.每当我尝试在代码中访问 traitCollection 时,都会收到以下错误:

My storyboard is build in xcode6 and is using the new constraint based layouts. My app runs in two configurations, wRegular hRegular and wCompact hAny. Any time I try to access the traitCollection in code I get the following error:

[MYUIControllerName traitCollection]: unrecognized selector sent to instance.

我也尝试过实现以下功能,但从未被调用.

I have also tried implementing the following function, but it never gets called.

-(void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator

推荐答案

我认为 size classes 不起作用是不对的 <iOS 8. https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/DeployingSizeClassesonEarlieriOSVersions.html#//apple_ref/doc/uid/TP40014436-CH13-SW1

I don't think it's exactly right that size classes don't work < iOS 8. https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/DeployingSizeClassesonEarlieriOSVersions.html#//apple_ref/doc/uid/TP40014436-CH13-SW1

这篇关于访问 UIViewcontroller.traitCollection 编译但使我的应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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