don't use initWithNibName if the view controller is entirely coded programmatically, even if it works, that's very confusing. Get rid of your overriden initWithNibName method, and when you initialized call "init". If you want custom initialization, override init in your view controller. Note: in a view controller, override "init": for initialization that has to do with the view controller, not the view. For example, setting a BOOL ivar to YES. If you don't need to do anything in here, don't override it. "loadview": If you don't override this, all it will do is set self.view to a plain empty instance of UIView. Only override if you want to do something else, such as make self.view an instance of a custom UIView subclass, or set its backgroundcolor to red. If you override "loadview", you MUST set the self.view ivar. "viewDidLoad": Here you create everything that goes in the view, for example create a button and a label, and addSubview them to self.view.
|