UISplitViewController 方向改变时 Barstyle 也会改变
在我的 iPad 应用程序中,我通过以下代码将 barStyle 属性设置为 UIBarStyleBlack:
// in viewDidLoad
self.navigationController.toolbar.barStyle = UIBarStyleBlack;
奇怪的是,当我旋转 iPad 时,barStyle 将有时重置为灰色/灰色。关于为什么会发生这种情况有什么想法吗?
In my iPad app, I have the barStyle property set to UIBarStyleBlack by this code:
// in viewDidLoad
self.navigationController.toolbar.barStyle = UIBarStyleBlack;
Strangely, when I rotate my iPad, the barStyle will sometimes reset to the gray / grey color. Any ideas on why this might be happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
其实
会解决的。
Actually
will fix it.
这似乎与这个问题相同,该问题已被接受在我看来,答案似乎会起作用。
该问题中提供的信息帮助我理解该问题。在旋转时,不同的视图控制器被隐藏和显示,并且可能会释放它们的属性。答案的作者建议使用来自
UISplitViewController
的委托回调来确定何时重新设置栏样式,而不是标准 UIView 回调:http://developer.apple.com/library/ios/ #documentation/uikit/reference/UISplitViewControllerDelegate_protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40009454
This seems to be the same as this question, which has an accepted answer that seems to me like it would work.
The information provided in that question help me understand the problem. On rotation, different view controllers are being hidden and shown, and potentially, their properties deallocated. The answer's author suggests using the delegate callbacks from
UISplitViewController
to find out when to re-set your bar style, not the standard UIView callbacks:http://developer.apple.com/library/ios/#documentation/uikit/reference/UISplitViewControllerDelegate_protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40009454