首页 > 技术文章 > iOS Tips and Warning

zhudongfang 2015-03-12 08:42 原文

1,ImageView默认不可交互,可设置userInteractionEnabled=YES

2,xib中所有view默认tag都是0,所以要想通过viewWithTag获取控件,tag不能设置为0

3,TableView
(1) 设置TableView Item高度

  • TableView#rowHeight 适用于固定行高
  • Storyboard中设置,适用于固定行高
  • delegate中设置,适用于高度不固定

(2) TableViewCell#backgroundView优先级高于backgroundColor,同时设置backgroundView会覆盖backgroundColor

(3) TableViewCellStyle
//images0.cnblogs.com/i/450136/201405/272144370561004.png

(4)TableView去掉空白数据UITableView#tableFooterView = [[UIView alloc] init];

4,隐藏StatusBar

- (BOOL)prefersStatusBarHidden {
   return YES;
}

5,不要再init和dealloc中使用self.property,具体请看《不要在init和dealloc函数中使用accessor》

6,Extension就是匿名的Category

推荐阅读