I am positive that I have missed something开发者_开发技巧 simple here. I am attempting to load up a sub-view (modal view) as a separate controller in iOS. I have created a NIB file with a window that is pointing to my controller's view, the File's Owner class is set to my controller class, and I am attempting to call initWithNibName with the name of the nib file, but when I attempt to show it, it simply shows a blank view instead of the view I have build in the NIB file. Can it not be a window in the NIB if it is a modal sub controller? Or is there something else really obvious that I have missed?
You have to ensure that the file owner's (which must be a UIViewController
subclass) view property in your custom xib is set appropriately. If it is not, you'll get what you describe. I know this is what you say you are doing but I am highly skeptical. It's either that, or you are not linking the right view to the view
outlet of the file owner. When in doubt, disconnect and reconnect.
精彩评论