iPhone App Without NIBs

There have been numerous times when I have HATED Interface Builder. It can be a pain to launch when all you want to change to change is 1 little thing in an NIB. It can be extremely slow. If you change 1 thing you have the risk to have to reconnect all Outlets and Actions and there have been times when I spend hours making the view in Interface Builder and when I want to do something that Interface Builder does not support I have to create my own custom view from scratch. I have decided to avoid Interface Builder completely, unless I absolutely have to and I am not regretting my decision at all. I am now starting all of my new projects without a single NIB and I have an incredible amount of control now. Here is how to set up a iPhone app with out any NIBs.

**PROJECT is the name of you iPhone project.

1) Delete MainWindow.xib

2) Open Info.plist and remove the line that says “Main NIB File base name”

3) In main.m change

int retVal = UIApplicationMain(argc, argv, nil, nil);

to

int retVal = UIApplicationMain(argc, argv, nil, @"PROJECTAppDelegate");

4) Create the window that was in the NIB as soon as the application launches by adding this code to the beginning of the applicationDidFinishingLaunching: method

window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

Thats it! Now you don’t need a single NIB file in your project.

Happy Coding!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值