iPhone: What gets called after viewDidLoad before viewWillAppear?(iPhone:在 viewWillAppear 之前 viewDidLoad 之后调用了什么?)
问题描述
这里的行为真的很奇怪.我有一个内部带有滚动视图的视图,其中包含我的界面.
Really strange behaviour here. I've got a view with a scroll view inside, which contains my interface.
在我的 viewDidLoad
中,我将 scrollView 的框架设置为原点为 0,0.
In my viewDidLoad
, I set the frame of my scrollView to have an origin of 0,0.
我在 viewDidLoad
的末尾记录了原点,它是 0.但是,在我的 viewWillAppear
开头,原点是 -20.有谁知道可以调用哪种方法来做到这一点?
I log the origin at the end of my viewDidLoad
, and it's 0.
However, at the start of my viewWillAppear
, the origin is -20.
Does anyone know what kind of method could get called that would do this?
提前致谢
推荐答案
如果您想知道它可能是什么,您可以尝试注册您的视图以进行键值观察,如下所述:http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html
If you want to find out what it could be, you can try registering your view for key value observing, as described here: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html
您可以注册以侦听 frame 属性的更改,然后在 observe 方法中设置一个断点,当您的 origin 设置为奇怪的值时,它应该可以让您准确地看到堆栈跟踪的用途.
You can register to listen for changes to the frame property, and then set a breakpoint in the observe method which should let you see exactly what the stacktrace is for when your origin is set to the strange value.
这篇关于iPhone:在 viewWillAppear 之前 viewDidLoad 之后调用了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iPhone:在 viewWillAppear 之前 viewDidLoad 之后调用了什
基础教程推荐
- Android:对话框关闭而不调用关闭 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01