UIStackView with UILabels in Xcode 7.3(Xcode 7.3 中带有 UILabel 的 UIStackView)
问题描述
自从我更新到 Xcode 7.3 后,我遇到了 UIStackView 的问题.如果我创建一个空项目并将两个 UILabel 放入具有默认拥抱和压缩优先级的 UIStackView 中,它会显示 AutoLayout misplacement 错误.它甚至不适用于 UIStackView 中的一个(!)UILabel,所以优先级并不重要(我认为,也许有问题).
Since I've updated to Xcode 7.3 I have a problem with UIStackView. If I create an empty project and just put two UILabels in UIStackView with default hugging and compression priorities, it shows me AutoLayout misplacement error. It even doesn't work with one(!) UILabel in UIStackView, so priorities doesn't matter (as I think, maybe there is the problem).
我记得在 Xcode 7.3 之前的版本中一切都很好.我分别检查了两台 MacBook Pro,这是同一个问题.
As I remember in Xcode prior 7.3 everything was fine. I checked on two MacBook Pro separately, it's the same issue.
有人知道怎么解决吗?
推荐答案
这是 Xcode 7.3 中出现的一个 bug,所以你可以忽略它,就像他所说的 matt.
This is a bug appears in Xcode 7.3, so you can ignore it as what he said matt.
问题
使用 UIStackView 时,storyboard 无法计算子视图的内在内容大小
The storyboard can not calculate the intrinsic content size of subviews when you use UIStackView
解决方案
如果您讨厌在情节提要中看到警告,您可以像下面这样修复它:
If you hate seeing warnings in your storyboard you can fixe it like below :
您应该为 UIStackView
- 点击子视图的警告
- 点按更新帧"选项
- 在第四个菜单中选择子视图固有大小的占位符"检查员视图
这样你不会看到警告,你可以看看是否存在任何歧义
Like that you will not see warnings, and you can see if any ambiguities exist
缺点是每次更改子视图时都应该执行此步骤(例如:更改 UILabel 的文本大小)
The disadvantage is you should do this steps each time you change your subview (example: changing the size of text of an UILabel)
希望 Apple 在下一个版本中修复此错误
Hoping that Apple fixes this bug in the next release
这篇关于Xcode 7.3 中带有 UILabel 的 UIStackView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Xcode 7.3 中带有 UILabel 的 UIStackView
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iOS4 创建后台定时器 2022-01-01
