Creating UIViews programmatically
If you want to create a new UIViewController object without using a Nib file in Interface Builder, you must use the loadView method. It's rather simple, but key to doing things programmatically.
Once your view is created, you are free to implement, as usual, viewDidLoad, viewWillAppear, viewDidAppear, etc.
- (void)loadView { CGRect viewFrame; viewFrame = CGRectMake(0, 0, MASTER_WIDTH, MASTER_HEIGHT); self.view = [[[UIView alloc] initWithFrame:viewFrame] autorelease]; }(Note: MASTER_WIDTH and MASTER_HEIGHT are simply constants defining the width and height of the screen.)
Once your view is created, you are free to implement, as usual, viewDidLoad, viewWillAppear, viewDidAppear, etc.
Labels: loadView, programmatically, uiview, UIViewController
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home