uiviewuiviewcontrollerinitializationsubclassloadview

Use a different class for UIViewController's View property


By default UIViewController's view property is a UIView instance. Is it possible to change it to instead be an instance of MyView, a subclass of UIView, without having to override the -view getter to return an instance of MyView? With storyboards this is very easy and can be done in the identity inspector- surely there must be an equivalent and official programmatic way?


Solution

  • i have found the simple answer here where I simply have to override -loadView