简体   繁体   English

XCode 6.1 UIImageView消失了

[英]XCode 6.1 UIImageView disappears

Related question: Text views and image view disappearing from view controller in Xcode 6.1 storyboard 相关问题: 文本视图和图像视图从Xcode 6.1故事板上的视图控制器中消失

That started happening after the latest update to XCode 6.1 a couple of days ago. 在几天前对XCode 6.1进行了最新更新之后,这种情况开始发生。 I've got a very primitive layout: 我有一个非常原始的布局:

在此处输入图片说明

If I open the storyboard source code and then switch back to the Interface Builder mode, then all UIImageView dimensions become zeros. 如果打开情节提要源代码,然后切换回Interface Builder模式,则所有UIImageView尺寸均变为零。

在此处输入图片说明

Not depending on whether I can see the UIImageView in the storyboard, it won't appear in the running app. 不取决于我是否可以在情节提要中看到UIImageView,它不会出现在正在运行的应用程序中。 The storyboard and the app worked fine prior to the update to XCode Version 6.1 (6A1052d) 在更新到XCode版本6.1(6A1052d)之前,情节提要和应用程序运行良好。

dispatch_async(dispatch_get_main_queue()) {
    self.myImage.sizeToFit()
    let img : UIImage = UIImage(data: imgData.value)!
    self.myImage.image = img
}

Turns out XCode 6.1 imposes more strict constraints on the storyboard layout ( not sure whether it is a bug or a feature ). 事实证明,XCode 6.1对情节提要板布局施加了更严格的约束( 不确定是错误还是功能 )。

Here are the steps which worked for me. 以下是对我有用的步骤。

Storyboard view 故事板视图

在此处输入图片说明

Constraints 约束条件

在此处输入图片说明

UIImageView content mode UIImageView内容模式

在此处输入图片说明

Prior to XCode 6.1 I didn't have any specific constraints on the UIImageView. 在XCode 6.1之前,我对UIImageView没有任何特定的限制。 With XCode 6.1 it looks like the constraints are not optional any more. 对于XCode 6.1,约束似乎不再是可选的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM