自动布局和子视图 [英] Autolayout and subviews

查看:158
本文介绍了自动布局和子视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iAd的套房,从苹果的故事板,按照这个链接...
<一href=\"https://developer.apple.com/library/$p$prelease/ios/sample$c$c/iAdSuite_Storyboard/Introduction/Intro.html\">Apple iAd的故事板文档

I am using the iAd suite with storyboards from Apple, as per this link... Apple iAd Storyboard documentation

直到我打开自动布局的这一切工作正常。它建立罚款,但崩溃上运行。我得到的输出是:

It all works fine until I turn autolayout on. It builds fine but crashes on running. The output I get is:

2013年8月24日12:06:36.138 TabbedBanner [7272:C07]中的 *断言失败 - [UIView的layoutSublayersOfLayer:],/SourceCache/UIKit_Sim/UIKit-2380.17/UIView.m:5781
2013年8月24日12:06:36.139 TabbedBanner [7272:C07]的
终止应用程序由于未捕获的异常'NSInternalInconsistencyException,理由是:自动布局仍然需要发送-viewDidLayoutSubviews到视图控制器之后。 BannerViewController的实现需要发送-layoutSubviews到视图调用自动布局。
*
的*第一掷调用堆栈:
(0x1e27012 0x110ee7e 0x1e26e78 0xba4665 0xa347a 0x11226b0 0x1358fc0 0x134d33c 0x1358eaf 0x1422bd 0x8ab56 0x8966f 0x89589 0x887e4 0x883ef 0x65c9d 0x5098b 0x5194b 0x62cb5 0x63beb 0x55698 0x1700df9 0x1700ad0 0x1d9cbf5 0x1d9c962 0x1dcdbb6 0x1dccf44 0x1dcce1b 0x5117a 0x52ffc 0x2a0d 0x2935)
的libc ++ abi.dylib:终止称为抛出异常
(LLDB)

2013-08-24 12:06:36.138 TabbedBanner[7272:c07] * Assertion failure in -[UIView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIView.m:5781 2013-08-24 12:06:36.139 TabbedBanner[7272:c07] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after sending -viewDidLayoutSubviews to the view controller. BannerViewController's implementation needs to send -layoutSubviews to the view to invoke auto layout.' ** First throw call stack: (0x1e27012 0x110ee7e 0x1e26e78 0xba4665 0xa347a 0x11226b0 0x1358fc0 0x134d33c 0x1358eaf 0x1422bd 0x8ab56 0x8966f 0x89589 0x887e4 0x883ef 0x65c9d 0x5098b 0x5194b 0x62cb5 0x63beb 0x55698 0x1700df9 0x1700ad0 0x1d9cbf5 0x1d9c962 0x1dcdbb6 0x1dccf44 0x1dcce1b 0x5117a 0x52ffc 0x2a0d 0x2935) libc++abi.dylib: terminate called throwing an exception (lldb)

我知道这是什么做的,在故事板子视图,但我不知道如何纠正这一错误。我是pretty新iOS和试图教自己,所以任何帮助AP preciated。非常感谢

I know it is something to do with the subviews in storyboard but I dont know how to correct this error. I am pretty new to iOS and trying to teach myself so any help is appreciated. Many Thanks

推荐答案

地址:

[self.view layoutIfNeeded];

这种方法的结束

- (void)viewDidLayoutSubviews

里面的 BannerViewController

这篇关于自动布局和子视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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