我又遇到了一个超级奇怪的问题。无论是在模拟器上还是在 iPhone 上运行应用程序,我都会得到不同的输出。
查看这些控制台日志:
iPhone 首次运行,点击了第一个职业单元格
2011-06-23 14:47:28.974 Acando[2033:307] 1 - loadView method running
2011-06-23 14:47:29.156 Acando[2033:307] 2 - viewDidLoad method running
2011-06-23 14:47:29.159 Acando[2033:307] 3 - viewWillAppear method running
[Switching to process 12803 thread 0x0]
[Switching to process 11523 thread 0x0]
2011-06-23 14:47:29.689 Acando[2033:307] 4 - viewDidAppear method running
2011-06-23 14:47:29.692 Acando[2033:307] View: UILabel, height: 21.000000
2011-06-23 14:47:29.695 Acando[2033:307] View: UIWebView, height: 400.000000
2011-06-23 14:47:29.851 Acando[2033:307] webViewDidFinishLoad method running
2011-06-23 14:47:29.855 Acando[2033:307] UIWebView dynamic height: 1150.000000
[Switching to process 12547 thread 0x0]
模拟器 第一次运行,点击第一个职业单元格
2011-06-23 14:46:26.405 Acando[92098:207] 1 - loadView method running
2011-06-23 14:46:26.421 Acando[92098:207] 2 - viewDidLoad method running
2011-06-23 14:46:26.422 Acando[92098:207] 3 - viewWillAppear method running
[Switching to process 92098 thread 0x2003]
[Switching to process 92098 thread 0x207]
2011-06-23 14:46:26.484 Acando[92098:207] webViewDidFinishLoad method running
2011-06-23 14:46:26.485 Acando[92098:207] UIWebView dynamic height: 1150.000000
[Switching to process 92098 thread 0x6703]
2011-06-23 14:46:26.781 Acando[92098:207] 4 - viewDidAppear method running
2011-06-23 14:46:26.782 Acando[92098:207] View: UILabel, height: 21.000000
2011-06-23 14:46:26.783 Acando[92098:207] View: UIWebView, height: 1150.000000
似乎在 iPhone 上,方法是在方法之后webViewDidFinishLoad
加载的。viewDidAppear
但是在模拟器上是在方法之前webViewDidFinishLoad
加载的。viewDidAppear
是什么赋予了?
编辑:更奇怪的是,这仅在我单击加载具有我的 UIScrollView 和 UIWebView 的视图控制器的第一个单元格时发生。我单击该webViewDidFinishLoad
方法的所有后续单元格都在该方法之前加载viewDidAppear
。
有什么办法可以纠正这个吗?