If I override the loadView method, loadView will be called whether there is a nib file. If I don’t override loadView and there is a nib file, will it be called ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes,
loadViewis responsible for loading nib files automatically from known bundles based on the class name of the view controller. If you overrideloadViewand don’t call[super loadView], no nibs will be loaded. The UIViewController class will callloadViewwhen itsviewproperty is called and is nil.Also note that overriding
loadViewand calling super is most likely not what you want.loadViewis for setting theself.viewproperty, that’s it. Everything else should happen inviewDidLoadetc.