drawRect vs addSubview on UITableViewCells
I'm customizing the UITableviewCells and I'm trying to figure out which is the most efficient way to do this.
So basically I need to add 3 text 开发者_StackOverflow中文版strings and 2 images. I could do this by creating UIImageViews and UILabels, but I could also draw it myself by subclassing UITableViewCell. Also I'm concerned about animation on the cells (when going to editMode).
Which is the most efficient way to do this and which one will allow me to do custom animations ?
You are going to need to subclass UITableViewCell in any case
Add the 3 text strings and 2 images to the UITableViewCell
Now, for the animation of the cells. This raises the same problems/questions as any kind of animation would.
Can you describe some more about what you mean by "Custom Animations" - and what your animating? Are you planning on animating the contents inside one of the UIImageViews? If so - maybe a UITimer to fire a needsUpdate on the rect, evoking drawRect in the UIImageView is the way to go.
If you want to do a more standard frame-by-frame type animation from a fixed image (like an animated GIF, for example) - UIImageView will flip between a series of images every [specified] time interval - and can autorepeat.
If you're taking about animating location and rotation, you can just use the standard Animation calls to do that - or via an NSTimer.
So it depends on what level of "Animation" you mean...
精彩评论