没用.xib文件创建视图,使用了loadview方法,但是当调用loadView的时候,view的框架还未知。因此我建立的view层,没有具体框架。问题是,能不能用[[UIView alloc] init]
或者[[UIView alloc] initWithFrame:CGRectZero]
或者其他方法,初始化未知框架的view?
代码:
- (void)loadView
{
UIView *containerView = [[UIView alloc] init];
// or
// UIView *containerView = [[UIView alloc] initWithFrame:CGRectZero];
// or something else?
// ...
self.view = containerView;
[containerView release];
}