iPhone:在viewWillAppear之前的viewDidLoad之后调用什么? [英] iPhone: What gets called after viewDidLoad before viewWillAppear?

查看:117
本文介绍了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方法中设置一个断点,该断点可以让您准确了解堆栈跟踪的用途。原点设置为奇怪的值。

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之后调用什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆