nib文件的默认搜索规则
if you do not specify a nib name, and do not override the loadView
method in your custom subclass, the view controller searches for a nib file using other means. Specifically, it looks for a nib file with an appropriate name (without the .nib
extension)
-
If the view controller class name ends with the word ‘Controller’, as in
MyViewController
, it looks for a nib file whose name matches the class name without the word ‘Controller’, as inMyView.nib
. -
It looks for a nib file whose name matches the name of the view controller class. For example, if the class name is
MyViewController
, it looks for aMyViewController.nib
file.