diwu / DWURecyclingAlert

Optimizing UITableViewCell For Fast Scrolling
MIT License
559 stars 38 forks source link

move some function into calayer #6

Closed DaidoujiChen closed 9 years ago

DaidoujiChen commented 9 years ago

Hello @diwu,

這次的改動比之前的有大一些, 主要是有些散落在外的 function, 應該是可以被歸併到 CALayercategory 裡面, 並在前面都加上 dwu_ 前綴.

寫了一些簡單的 #pragma mark 分別源碼的功能性.

剩下一些地方就比較小, 像是

SEL imageSelector = NSSelectorFromString(@"image");

to

SEL imageSelector = @selector(image);

少一次轉換, 然後

id returnValue = ((id ( *)(id, SEL, id, id))objc_msgSend)(_self, targetSelector, arg1, arg2);

to

UIView *returnView = ((UIView * ( *)(id, SEL, id, id))objc_msgSend)(_self, targetSelector, arg1, arg2);

直接當 UIView 取出來, 則不用再作轉換

for (CALayer *subview in layer.sublayers)

to

for (CALayer *sublayer in self.sublayers)

等等之類的小地方. 感謝.

DaidoujiChen commented 9 years ago

喔對了, 另外我有在想, 是不是該所有的 function 都加上 dwu_ 前綴? 目前是有些有, 有些沒有, 這個我沒有幫你決定, 由你來決定要不要加.

diwu commented 9 years ago

Thanks a lot. I'll add the dwu_ prefix to all C functions. Though it's purely for aesthetic reasons, since every function is guarded by the static specifier and is not visible outside the translation unit.

DaidoujiChen commented 9 years ago

:+1: