Dynamically load nib for iPhone/iPad within view controller

前端 未结 5 2094
悲哀的现实
悲哀的现实 2020-12-24 13:30

I have converted an iPhone application using the wizard like thing in XCode into a universal app.

It builds fine but obviously looks a bit rubbish in some areas :)<

5条回答
  •  情书的邮戳
    2020-12-24 14:04

    You can have your cake and eat it too. Just add a method that wraps initWithNibName:bundle: and adds your myLovelyData parameter:

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil  myLovelyData:(id)data
    {
        if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) 
        {
            // Custom initialization using myLovelyData
            //
        }
        return self;
    }
    

提交回复
热议问题