ios 知識點

正確設定背景圖片

  1. 創建小的重複的圖片作爲背景的, 使用UIColor的 colorWithPatternImage來設置背景色.
  2. 大背景圖, 在view中添加一個UIImageView作爲一個子View

設定Shadow Path

view.layer.shadowPath = [[UIBezierPath bezierPathWithRect:view.bounds] CGPath];

優化Table View

正確使用reuseIdentifier來重用cells
儘量使所有的view opaque,包括cell自身
避免漸變,圖片縮放,後臺選人
緩存行高
如果cell內現實的內容來自web,使用異步加載,緩存請求結果
使用shadowPath來畫陰影
減少subviews的數量
儘量不適用cellForRowAtIndexPath:,如果你需要用到它,只用一次然後緩存結果
使用正確的數據結構來存儲數據
使用rowHeight, sectionFooterHeightsectionHeaderHeight來設定固定的高,不要請求delegate

選擇是否緩存圖片

imageWithContentsOfFile 不緩存
imageNamed 緩存

block array need copy first

查看引用計數

NSLog(@"retain count = %d", _objc_rootRetainCount(obj));

將objc文件編譯成C++文件

clang -rewrite-objc file_name_of_the_source_code

nonatomic && atomic

nonatomic屬性讀取的是內存數據(寄存器計算好的結果)
atomic就保證直接讀取寄存器的數據

set do not back up attribute

NSURL * fileURL;
fileURL = [ NSURL fileURLWithPath: @"some/file/path" ];
[ fileURL setResourceValue: [NSNumber numberWithBool: YES] forKey: NSURLIsExcludedFromBackupKey error: nil ];
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章