iphone开发之viewDidLoad
2011-05-27 16:05
204 查看
在一篇名为
loadView 和 viewDidLoad 的区别
的copy文章中
写到 viewDidLoad 方法只有当 view 从 nib 文件初始化的时候才被调用。viewDidLoad 用于初始化,加载时用到。
不知道是谁先误解英文原文,写错了,却又许多人跟宝一样到处传
我想说的是
viewdidload和willappear是一个系列的东西,根本不是那么回事,没有这个限制,viewdidload是可以走到。
头文件这样写到
- (void)loadView; // This is where subclasses should create their custom view hierarchy if they aren't using a nib. Should never be called directly.
- (void)viewDidLoad; // Called after the view has been loaded. For view controllers created in code, this is after -loadView. For view controllers unarchived from a nib, this is after the view is set.
就很明显了。
希望各位在学习iphone开发的朋友,多看看文档,自己多动手试试,不要被一些国内的文章所误导。
有某位网友回复说:
不过viewDidLoad 的确有时候不被调用.
在didFinishLaunchingWithOptions 中做个简单的例子
viewController.view = aNewView;
[self.window addSubview:viewController.view];
[self.window makeKeyAndVisible];
这个时候不被调用!!!
这个我没试过,也许是真的吧,试试才知道啊。
loadView 和 viewDidLoad 的区别
的copy文章中
写到 viewDidLoad 方法只有当 view 从 nib 文件初始化的时候才被调用。viewDidLoad 用于初始化,加载时用到。
不知道是谁先误解英文原文,写错了,却又许多人跟宝一样到处传
我想说的是
viewdidload和willappear是一个系列的东西,根本不是那么回事,没有这个限制,viewdidload是可以走到。
头文件这样写到
- (void)loadView; // This is where subclasses should create their custom view hierarchy if they aren't using a nib. Should never be called directly.
- (void)viewDidLoad; // Called after the view has been loaded. For view controllers created in code, this is after -loadView. For view controllers unarchived from a nib, this is after the view is set.
就很明显了。
希望各位在学习iphone开发的朋友,多看看文档,自己多动手试试,不要被一些国内的文章所误导。
有某位网友回复说:
不过viewDidLoad 的确有时候不被调用.
在didFinishLaunchingWithOptions 中做个简单的例子
viewController.view = aNewView;
[self.window addSubview:viewController.view];
[self.window makeKeyAndVisible];
这个时候不被调用!!!
这个我没试过,也许是真的吧,试试才知道啊。
相关文章推荐
- iphone开发之viewDidLoad
- iphone开发之viewDidLoad
- iphone开发基础:loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法
- iphone开发基础:loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法
- iphone开发中loadView和viewDidLoad的区别
- 【IPhone开发】Delegate和ViewController的生命周期研究
- iphone开发笔记:为UIImageView添加点击事件
- iPhone开发之解决viewWillAppear不被调用
- iPhone开发之UIViewController中的viewAppear与viewDisappear方法的区别
- iphone开发之表格组件UITableView的使用(四) 通过加载plist文件展示单组数据
- IPhone开发中tableview cell的气泡样式的实现
- ios iphone开发中使用UIActivityIndicatorView 控件来做等待提示。
- iphone开发 tableview中cell的用法
- ios开发中ViewDidLoad和loadView的区别
- iPhone开发【四】常用控件之ActionSheet与AlertView
- iPhone开发【六】常用控件之Picker View
- iPhone应用开发 UITableView学习点滴详解
- 【iphone应用开发】iPhone应用开发之四:UIImageView和UIWebView的详细讲解
- iphone开发必知点之--填充view纹理背景
- [IOS] iphone开发之UITableView之UITableViewCell [待续中。。。]