views“约会电话后出现问题,swift
问题描述:
我添加了主要板块对视图的限制。我加入了一些意见,这样子视图这些代码:views“约会电话后出现问题,swift
let controller:profileOther = self.storyboard!.instantiateViewControllerWithIdentifier("profileOther") as! profileOther
controller.view.frame = self.view.bounds;
controller.willMoveToParentViewController(self)
self.view.addSubview(controller.view)
self.addChildViewController(controller)
controller.didMoveToParentViewController(self)
所以通常我加入左视图和右侧边距为0增加的视图。但是,随着我的意见,我设置-20左右的边缘。它工作得很好,但问题是有人在我使用程序时调用了我。如果添加的视图已经打开,所有约束都会出错。如果来自segue的视图被打开,那么约束仍然很好。预期和打电话后的意见都在链接中。我会很感激答案。谢谢。
答
func application(application: UIApplication, willChangeStatusBarFrame newStatusBarFrame: CGRect) { for window in UIApplication.sharedApplication().windows { if window.dynamicType.self.description().containsString("UITextEffectsWindow") { window.removeConstraints(window.constraints) } } }
+0
不幸的是它不起作用 –
,而不是设置限制-20相对于空间,简单地设置的约束为0领先&而不相对于余量尾随。 – Paulw11
它是零,但我仍然得到相同的结果 –