代码改变世界

实战练习细节(分行/拼接字符串/字符串转int/weak和copy)

2015-07-07 10:19  一树一菩提  阅读(217)  评论(0编辑  收藏  举报

1. Label 文字描述太长的,需要分行显示

解决:只需要设置Label的一个属性Lines = 0;

 

2.拼接字符串

[NSString stringWithFormat:@"image_%02d.png", i]

 %02d:表示保留2位,不足补零,例如:image_05.png

3.字符串转int

  int count = [dict[key] intValue];

 4.属性的定义:

 一般:UI控件都用weak,NSString用copy,其他对象用strong

@property (nonatomic, copy) NSString*provience;

@property (nonatomic, strong) NSArray *array;

@property (nonatomic, weak) UIButton *btn;