How do I initialize a view without a known frame?
I am creating a view without a file .xib
using the method loadView
. But at the point when loadView is called, the frame of view is not yet known. So I only use it to create a view hierarchy without specific frames. (Than I am updating the view layout when known). The question is, should I use, [[UIView alloc] init]
or [[UIView alloc] initWithFrame:CGRectZero]
or could there be something else, to initialize a view without a known frame? Here is the code:
- (void)loadView
{
UIView *containerView = [[UIView alloc] init];
// or
// UIView *containerView = [[UIView alloc] initWithFrame:CGRectZero];
// or something else?
// ...
self.view = containerView;
[containerView release];
}
+3
source to share