构建 iOS Hello World 应用全流程指南
1. 分离类声明与实现的好处
将类声明与实现分离能让代码更灵活,提高代码的可重用性。当修改类的底层实现时,无需重新编译使用该类的多个源文件。
2. 应用代理类的声明与实现
2.1 应用代理类的声明
点击 AppDelegate.h 文件,可看到应用代理类的声明:
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate> {
}
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) ViewController *viewController;
@end
此声明以 @interface 指令开始,以 @end 指令结束。 AppDelegate 类是 UIResponder 的子类,实现了 UIApplicationDelegate 协议。声明了 UIWindow 和 ViewController 对象作为类的属性。
超级会员免费看
订阅专栏 解锁全文
24

被折叠的 条评论
为什么被折叠?



