没有 nib 的 iphone 程序

Interface Builder 开始用还觉得酷炫浮华,越用越觉得不对劲,对于刚开始学写 iphone 程序,没有帮助理解代码,反而隐藏了需要知道的内容,然后用线连啊连,连着连着就晕了。另外,重点是,牛人都直接用代码写 GUI 的啊 XD。刚才试了一下不用 nib,只用敲 code,真的可以耶。步骤如下:

1. 新建一个 Window-Based Application 项目

2009-01-07_1714

2. 删掉

1
MainWindow.xib

文件

2009-01-07_1720

3. 删掉

1
Info.plist

里面的

1
Main nib file base name

属性

2009-01-07_1720_1

4. 把

1
main.m

文件中的

1
UIApplicationMain

函数最后一个参数由

1
nil

改为 

1
@"NiblessHelloWorldAppDelegate"

也就是我们的主要 delegate 的类名字

2009-01-07_1722

5. 把

1
NiblessHelloWorldAppAppDelegate.h

文件里的

1
IBOutlet

声明删掉(不删也行)

2009-01-07_1722_1

6. 在

1
NiblessHelloWorldAppDelegate.m

的程序启动回掉函数里加上我们自己创建 window 以及 view 的代码

2009-01-07_1723

7. Build And Go Go Go。。。

2009-01-07_1739

项目文件打包在这里,请自取。。。

2 comments to 没有 nib 的 iphone 程序

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>