首页 > 其他 > 详细

Effective Objective-C 2.0 学习第一天

时间:2015-07-19 23:21:03      阅读:231      评论:0      收藏:0      [点我收藏+]

重要知识点个人理解记录

第一条:OC 是消息结构语言,运行时解析,编译时不care

第二条:头文件引入尽量不要再.h文件中(编译费事),哪里用到哪里导入,一般在.m中导入。不要忘记@class可以在.h文件中声明。

第三条:多用简化语法,例如 NSArray *a = @[@"x",@"xx"];对于可变数组 [@[@"s",@"ss"] mutableCopy];

第四条:少用#define定义常量。 static NSString *const xxx = @"222";

.h文件

#import "BaseViewController.h"

static const int kWidth = 3;

static const int kHigh ;

extern NSString *const ConstKey;

@interface ConstViewController : BaseViewController

@end

 

 .m文件

#import "ConstViewController.h"

 const int kHight = 100;

NSString *const ConstKey = @"111";

@interface ConstViewController ()

@end

@implementation ConstViewController

 - (void)viewDidLoad {

    [super viewDidLoad];

}

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

}

@end

 

Effective Objective-C 2.0 学习第一天

原文:http://www.cnblogs.com/ymlike7/p/4660061.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!