开发者

iPhone Obj C - change startup root class?

I am learning iPhone Obj C slowly. I have a XIB with several views and all works well. I need to have a 2nd XIB to control another set of views but haven't been able to make it work.

So I created the 2nd class and a 2nd XIB, all called one.h one.m one.xib and the same for the new one is all two.*

As it didnt work I was going try and change the app to start on the TWO class rather than the ONE class. In the plist I changed the Main Nib base file but that didnt seem to do anything.

Where do you specify what the start up class is? That way I can mak开发者_如何学Pythone sure I did everything correctly first, and then go back to the code that is supposed to call the two class and xib.

Also if anyone has any sample code to go from one class and xib to another, please let me know.

thanks!


In your AppDelegate class make sure the ViewController being allocated and set to the window is the one desired.


Your project's [ProjectName]-Info.plist file decides which Nib file is used when the application starts, in the key NSMainNibFile. (By default, this is set to MainWindow.)

A standard MainWindow.nib file will define the "root" class, which is usually [ProjectName]AppDelegate. You can, however, change this by editing the nib.


I had to set the CLASS IDENTITY to the proper class for the app delegate on the XIB for both XIB.

Then I changed the plist to point to the XIB I wanted to start as root.

Both of the answers above helped me find this.

THANK YOU

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜