IPHONE应用开发 - xib关联到appdelegate

1.创建Empty application,此时项目中只有一个AppDelegate的类

Start with Empty Application template

2.新建文件,选择User Interface下的Empty 命名为MainWindow

Add Empty Interface Builder document

3.打开新建的MainWindow.xib文件

The empty design surface of MainWindow.xib

 

 

 

4.将File's Owner的类名修改为UIApplication

Change class of File's Owner to UIApplication

5. 在Library中拖放一个Object到图下的位置

Add Object to the document

6.将该object的类名修改为文件中AppDelegate的类名(同时还可以给object命名下Label)

Change class of the object to xAppDelegate

7.拖放一个Window到左边

Add a window to the document

8. 在xAppDelegate的h文件中,给window的属性加上IBOutlet

@interface DemoAppDelegate :
      UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) IBOutlet UIWindow *window;
@end

 

 

9.将File's Owner 和 拖放的Object按照以下方式连接

Link the application delegate

 

Link the window outlet of the app delegate

 

 

10.在项目属性中,把Main Interface修改成你的xib文件名MainWindow

Set the Main Interface to MainWindow

11. 在xAppDelegate.m文件中,将

- (BOOL) application:didFinishLaunchingWithOptions:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值