开发者

How can I make my custom UITableViewCells as fast as possible?

开发者 https://www.devze.com 2023-03-23 00:47 出处:网络
I\'m creating custom UITableViewCells, and I\'d like to make them in a way that allows the table view\'s scrolling to be as smooth as 开发者_运维问答possible. In their current state, with a custom bac

I'm creating custom UITableViewCells, and I'd like to make them in a way that allows the table view's scrolling to be as smooth as 开发者_运维问答possible. In their current state, with a custom background image on each cell using the cell's backgroundView property, scrolling is is still fairly smooth.

But my question is, how can I add content to the cell and maintain this? The cells are fairly different from each other -- one may have a single label, another may have two labels and an icon, and another may have a bunch of other controls.

I've found that using unique cell identifiers for non-similar rows makes the overall experience laggy, so I need a method that allows me to use the same cell identifier and have very different cells.

Should I be using an XIB for this? If not, how should my subclass function? I was thinking of adding all of the controls to the cell, and only hiding/using the ones necessary at the time. Is there a cleaner way?

0

精彩评论

暂无评论...
验证码 换一张
取 消