- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
UIView
方法 setNeedsLayout
和 setNeedsDisplay
之间的真正区别是什么?
像往常一样,文档对此模糊不清。
最佳答案
实际上文档对此很清楚:
setNeedsLayout将布局 subview
Call this method on your application’s main thread when you want to adjust the layout of a view’s subviews.
setNeedsDisplay将要求重绘您的 View (drawRect:
等)。
You can use this method or the setNeedsDisplayInRect: to notify the system that your view’s contents need to be redrawn.
关于ios - setNeedsLayout 和 setNeedsDisplay,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14506968/
我有一个带有单元格的 TableView ,有时它有一个可选的 UI 元素,有时它必须被删除。根据元素,标签会调整大小。 初始化单元格时,它比以后要窄。当我将数据设置到标签中时,从 cellForRo
我有一个分组格式的 UITableView,其中有几个单元格。单元格中有一个 UIView,我要向其添加另一个 UIView。当我更新第一个 UIView 的框架时,它不会改变它的位置和大小。 如果单
动画约束变化的标准方法是。 // Change constraints like: someConstraint.constant = 100 UIView.animate(withDuration:
我想知道 Apple 的 -setNeedsLayout 是如何工作的。 我已经知道它比直接调用 -layoutSubviews 更有效,因为我可能需要在一个方法中执行两次。 这正是我需要它的目的:一
UIView 方法 setNeedsLayout 和 setNeedsDisplay 之间的真正区别是什么? 像往常一样,文档对此模糊不清。 最佳答案 实际上文档对此很清楚: setNeedsLayo
一些 S.O.问题展示了一种自动布局技术,用于确定 View 满足其约束所需的最小尺寸:[header systemLayoutSizeFittingSize: UILayoutFittingComp
据我所知, -setNeedsLayout 方法仅将标志设置为 View ,以便在下一个更新周期布局 subview 。但是 layoutIfNeeded 立即调用 layoutSubviews 方法
从 OSX 10.7 开始,如果您希望执行 NSView 的手动布局,您应该通过覆盖 layout 方法来实现,并且无论何时您希望安排对该方法的调用,您只需执行以下操作: [myView setNee
在 iOS 上,是否有必要在以编程方式更改约束常量后进行任何 API 调用(例如 setNeedsLayout 或 layoutIfNeeded)?在我的用例中,我对动画变化不感兴趣。我相信存在一些错
我想在当前 ViewController 的底部显示一个 ViewController,具有特定的高度。然后我添加了将 ViewController 向上移动的功能,一直到 StatusBar 的后面
我的 ViewController 中有一个自定义 View ,我想更新它的一些信息。此信息是从 Firebase 异步绘制的。 我正在尝试使用 view.setNeedsDisplay 或 view
我有一个 UIViewController,在 willRotateToInterfaceOrientation 中,我正在调用 [self view] setNeedsLayout]; 这个 Vie
我已经阅读了一些关于 setNeedsLayout 和 layoutIfNeeded 之间的区别的文章,而我关注的是: 1。如果我想要立即布局,我是否需要同时调用这两个方法,因为我已经多次看到这种组合
我的图层有几个动态属性,这些属性会影响图层本身的布局和/或显示。如果我从属性的 setter 发送 setNeedsLayout/setNeedsDisplay 可以吗?还是由 setter 的调用者
似乎呈现和关闭 View Controller 都会提示 呈现 View 以布局其 subview 和/或更新其约束。对于繁重的 View 层次结构,这会引入性能问题。再次 - 这是现有的,当前显示的
我是否将这些东西放入显示方法中?或者有类似的东西吗? 最佳答案 从 OSX 10.7 开始: - (void)layout 相当于layoutSubviews 现在有一个相同的setNeedsLayo
我已成功对 UITableViewCell 进行子类化,并且我正在使用子类在我的应用程序中布局一些 TableViewCell。现在,我正在尝试将图像延迟加载到单元格中。根据日志,图像下载工作正常,但
我正在调用 API。根据我返回的 json 数据,我正在 viewDidLoad() 中修改我的 View Controller ,以便更改我的 View 设计以尽可能最好地显示给定数据。 我所做的是
我知道自动布局链基本上包含 3 个不同的过程。 更新约束 布局 View (这里是我们计算帧的地方) 显示 我不太清楚-setNeedsLayout 和-setNeedsUpdateConstrain
我有一个主视图 Controller 显示在屏幕上,一个类(代表)在后台运行获取位置。当我得到结果时,我调用 View Controller 中的委托(delegate)方法来更新屏幕上的标签。我尝试
我是一名优秀的程序员,十分优秀!