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 方法?
基础教程推荐
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01