在我的項目,我通過繼承UITableViewCell
創建自定義細胞。當cellForRowAtIndexPath:
被激發我做的一個非常基本的東西,如:配置自定義的UITableViewCell
MyCustomCell *cell = [self.tableView dequeueReusableCellWithIdentifier:[MyCustomCell identifier]];
我不想在cellForRowAtIndexPath:
手動配置單元格屬性,所以我想我會創建內部MyCustomCell
的方法稱爲configureWithModel:
這與正確填寫MyCustomCell
數據。到現在爲止還挺好!現在裏面cellForRowAtIndexPath:
我有類似:
MyCustomCell *cell = [self.tableView dequeueReusableCellWithIdentifier:[MyCustomCell identifier]];
[cell configureWithModel:model];
在configureWithModel:
我一些數據(圖像也)分配給細胞,從而你猜它可能是slow'n'heavy所以我不知道如果這是一個很好的解決方案在MyCustomCell
的子類中有這樣的方法?更重要的是,它與prepareForReuse
有什麼關係?