Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0

http://stackoverflow.com/questions/25398312/automatic-preferred-max-layout-width-is-not-available-on-ios-versions-prior-to-8

Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0

Update 3:
This warning can also be triggered by labels that have numberOfLines set to anything but 1 if your deployment target is set to 7.1. This is completely reproducible with new single-view project.

Steps to Reproduce:

  1. Create a new single-view, objective-c project
  2. Set the Deployment Target to 7.1
  3. Open the project's storyboard
  4. Drop a label onto the provided view controller
  5. Set the numberOfLines for that label to 2.
  6. Compile

I've filed the following radar:
rdar://problem/18700567

Update 2:
Unfortunately, this is a thing again in the release version of Xcode 6. Note that you can, for the most part, manually edit your storyboard/xib to fix the problem. Per Charles A. in the comments below:

It's worth mentioning that you can pretty easily accidentally introduce this warning, and the warning itself doesn't help in finding the label that is the culprit. This is unfortunate in a complex storyboard. You can open the storyboard as a source file and search with the regex <label(?!.*preferredMaxLayoutWidth) to find labels that omit a preferredMaxLayoutWidth attribute/value. If you add in preferredMaxLayoutWidth="0" on such lines, it is the same as marking explicit and setting the value 0.

Update 1:
This bug has now been fixed in Xcode 6 GM.

Original Answer
This is a bug in Xcode6-Beta6 and XCode6-Beta7 and can be safely ignored for now.

An Apple engineer in the Apple Developer forums had this to say about the bug:

Preferred max layout width is an auto layout property on UILabel that allows it to automatically grow vertically to fit its content. Versions of Xcode prior to 6.0 would set preferredMaxLayoutWidth for multiline labels to the current bounds size at design time. You would need to manually update preferredMaxLayoutWidth at runtime if your horizontal layout changed.

iOS 8 added support for automatically computing preferredMaxLayoutWidth at runtime, which makes creating multiline labels even easier. This setting is not backwards compatible with iOS 7. To support both iOS 7 and iOS 8, Xcode 6 allows you to pick either "Automatic" or "Explicit" for preferredMaxLayoutWidth in the size inspector. You should:

Pick "Automatic" if targeting iOS 8 for the best experience. Pick "Explicit" if targeting < iOS 8. You can then enter the value of preferredMaxLayoutWidth you would like set. Enabling "Explicit" defaults to the current bounds size at the time you checked the box.

The warning will appear if (1) you're using auto layout, (2) "Automatic" is set for a multiline label [you can check this in the size inspector for the label], and (3) your deployment target < iOS 8.

It seems the bug is that this warning appears for non-autolayout documents. If you are seeing this warning and not using auto layout you can ignore the warning.

Alternately, you can work around the issue by using the file inspector on the storyboard or xib in question and change "Builds for" to "Builds for iOS 8.0 and Later" Xcode file inspector

本项目采用C++编程语言结合ROS框架构建了完整的双机械臂控制系统,实现了Gazebo仿真环境下的协同运动模拟,并完成了两台实体UR10工业机器人的联动控制。该毕业设计在答辩环节获得98分的优异成绩,所有程序代码均通过系统性调试验证,保证可直接部署运行。 系统架构包含三个核心模块:基于ROS通信架构的双臂协调控制器、Gazebo物理引擎下的动力学仿真环境、以及真实UR10机器人的硬件接口层。在仿真验证阶段,开发了双臂碰撞检测算法和轨迹规划模块,通过ROS控制包实现了末端执行器的同步轨迹跟踪。硬件集成方面,建立了基于TCP/IP协议的实时通信链路,解决了双机数据同步和运动指令分发等关键技术问题。 本资源适用于自动化、机械电子、人工智能等专业方向的课程实践,可作为高年级课程设计、毕业课题的重要参考案例。系统采用模块化设计理念,控制核心与硬件接口分离架构便于功能扩展,具备工程实践能力的学习者可在现有框架基础上进行二次开发,例如集成视觉感知模块或优化运动规划算法。 项目文档详细记录了环境配置流程、参数调试方法和实验验证数据,特别说明了双机协同作业时的时序同步解决方案。所有功能模块均提供完整的API接口说明,便于使用者快速理解系统架构并进行定制化修改。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
### 解决 Mac 上 VSCode 开发 Flutter 时提示 `dart:ui` 不可用的问题 在 Mac 上使用 VSCode 进行 Flutter 开发时,若出现错误提示 `dart:ui' is not available on this platform`,通常是由于编辑器未能正确识别 Flutter SDK 或项目配置不完整所致。要解决此问题,需要确保 VSCode 能够准确加载 Flutter SDK,并正确配置 Dart 插件的相关路径。 #### 1. 确保正确配置 `dart.flutterSdkPath` 在 `.vscode/settings.json` 文件中设置 `dart.flutterSdkPath` 为本地 Flutter SDK 的实际路径,例如: ```json { "dart.flutterSdkPath": "/Users/用户名/flutter" } ``` 若 Flutter SDK 安装在 `/Users/gege/flutterdev/flutter3.27.1`,则应配置为: ```json { "dart.flutterSdkPath": "/Users/gege/flutterdev/flutter3.27.1" } ``` 该配置确保 VSCode 使用指定的 Flutter SDK 版本加载项目,并能正确解析 `dart:ui` 等核心库[^1]。 #### 2. 使用 FVM(Flutter Version Management)配置 SDK 路径 如果项目使用 FVM 管理多个 Flutter SDK 版本,则应将 `dart.flutterSdkPath` 设置为项目本地的 FVM 版本路径: ```json { "dart.flutterSdkPath": ".fvm/versions/3.27.1" } ``` 这种方式允许每个项目独立使用不同的 Flutter SDK 版本,避免全局 SDK 切换带来的问题,并确保 `dart:ui` 等核心库能被正确识别[^1]。 #### 3. 验证 VSCode 插件与 SDK 的兼容性 确保已安装最新版本的 **Dart** 和 **Flutter** 插件,并通过命令面板运行 `Flutter: Run Flutter Doctor` 检查 SDK 路径是否被正确识别。若 Flutter Doctor 显示 SDK 路径无误,则可确认 VSCode 已正确加载 Flutter 环境。 #### 4. 检查 Flutter SDK 安装完整性 如果 `dart:ui` 仍然无法识别,可能是因为 Flutter SDK 安装不完整或损坏。可尝试重新下载并解压 SDK,或使用以下命令更新 SDK: ```bash flutter upgrade ``` 确保 SDK 中包含完整的 `dart:ui` 源码和相关依赖。 #### 5. 清理 VSCode 缓存并重启 有时 VSCode 的缓存可能导致 SDK 路径识别异常。可尝试删除 VSCode 的缓存目录并重启编辑器: - 删除路径:`~/Library/Application Support/Code` - 或者使用命令:`rm -rf ~/Library/Application\ Support/Code` 重启后重新加载项目,查看是否仍提示 `dart:ui` 不可用。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值