macos - 更改 View 框架大小

标签 macos swift

正在处理https://github.com/madebybright/Nimble/

尝试在运行查询函数时更改 View 框架大小,但我不断收到

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.

当查询函数运行时。

viewDidLoad 中分配大小时一切正常,但在 query ( https://github.com/madebybright/Nimble/blob/unstable/Nimble/MenuViewController.swift#L43 ) 中会引发错误。

知道为什么吗?

最佳答案

是的。这是因为

This application is modifying the autolayout engine from a background thread.

:)

更具体地说,您必须在主线程上完成所有与 UI 相关的工作。您可以使用dispatch_async在主线程上排队任务(例如帧大小调整)。

关于macos - 更改 View 框架大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32175344/

相关文章:

macos - 我可以知道 NSTextField 文本部分的确切矩形吗?

swift 3/macOS : Open window on certain screen

ios - 使 Collection 符合自定义协议(protocol)

ios - 如何访问 Storyboard中的按钮名称

ios - 适用于 iOS 的 Facebook SDK : FBSDKShareDialog is not shown

swift - 点击标签进入下一页

xcode - 无法使用 SwiftUI Preview 在 Xcode 中预览 Widget

macos - npx pod 安装错误。中止运行并遇到意外错误

ios - 我可以在 Mac OSX 应用程序中使用 UIDocument 吗?

swift - 动画 meteor 在 Swift 3 中从上到下移动