Search code examples
objective-cuiviewuiviewcontrolleruikitsubclassing

Should I not override -[UIViewConvtroller view]?


I'm told not to override -(UIView *)view ever. Why not? I want to use a custom UIView subclass for my custom UIViewController. What's a better way to do so?


Solution

  • You're not supposed to override -view. To accomplish the behavior you want, you can set up your view controller to load from a nib, or you can override the -loadView method. In the latter method you create whatever view you want and assign it to self.view.