Is there an iOS method that fires when Autolayout has completed?(自动布局完成后是否会触发 iOS 方法?)
问题描述
我有一个 iOS 应用程序,我需要知道新视图何时在屏幕上完全可见;也就是说,当 Autolayout 完成计算并且视图完成绘制时.
I have an iOS app in which I need to know when a new view is completely visible on-screen; that is, when Autolayout has finished its calculations and the view has finished drawing.
ViewDidAppear 似乎在视图完全可见之前就触发了.如果我关闭 Autolayout,时间似乎与人类感知一致,但我需要在这个项目中使用 Autolayout(所以这不是一个解决方案......只是一个测试).
ViewDidAppear seems to fire well before the view is completely visible. If I turn off Autolayout, the timing seems to line up as far as human perception goes, but I need to use Autolayout in this project (so this isn't a solution...just a test).
自动布局计算完成后是否有任何方法可以触发?或者当视图实际可见时触发的另一种方法(因为 ViewDidAppear 不适用于此)?
Is there any method that fires when Autolayout is done calculating? Or another method that fires when the view is ACTUALLY visible (since ViewDidAppear doesn't work for this)?
谢谢!
推荐答案
我正在为此使用 viewDidLayoutSubviews.苹果的文档说,调用通知视图控制器它的视图刚刚布置了它的子视图."
I'm using viewDidLayoutSubviews for this. Apple's documentation says, "Called to notify the view controller that its view has just laid out its subviews."
这篇关于自动布局完成后是否会触发 iOS 方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:自动布局完成后是否会触发 iOS 方法?


基础教程推荐
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01