I wouldn't put too much stock in the link you reference. Many of the statements 
made are simply wrong, and there are better strategies.

In general, if you want to put custom stuff in a cell, you should do it by 
adding views - like labels, image views, etc. Only if you find a scrolling 
performance problem and only if via profiling analysis you can show that the 
performance problem is related to having too many views should you think about 
flattening the view hierarchy by using -drawRect.

If you stick to this strategy your life will likely be much simpler.

But, if you do end up deciding you need to flatten the view hierarchy, the much 
simpler way to do it is to create a view which implements -setHighlighted: and 
-isHighlighted add that view to the content. In reference to the problem about 
chevrons you mentioned before, you'll either need to make your view smart 
enough to handle drawing in a shortened-bounds situation, or just make the 
thing always be short (if it's 300 points in width regardless of whether the 
content view is 300 or 320, you don't have a problem). Then in your 
setHighlighted: method, you should cause your view to be redrawn in the 
appropriate way for highlighting (white text and whatever other changes you'd 
need). UITableViewCell will call setHighlighted: on your view at the 
appropriate time and there's no need to setup custom animation hooey.

Luke

On Apr 14, 2013, at 8:43 PM, Koen van der Drift 
<koenvanderdr...@gmail.com<mailto:koenvanderdr...@gmail.com>>
 wrote:

I'm using a custom UITableCellView, with a UIView where I do all the drawing as 
a subView of the contentView, more or less following the tutorial on this page: 
http://giorgiocalderolla.com/blog.html#customizing-uitableviewcells-a-better-way

I noticed that when I scroll the table, at one point the width of the 
contentView decreases from 320 to 300, and that messes up the drawing I do 
inside the view.  What I figured out so far is that this happens when the 
cell's accessory is set to UITableViewCellAccessoryDisclosureIndicator. When it 
is set to UITableViewCellAccessoryNone, the width stays at 320, and the drawing 
is fine. But I'd like to have the disclosure button. The style of the cell is 
UITableViewCellStyleDefault.

Any ideas or suggestions?

Thanks,

- Koen.



_______________________________________________

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.com<mailto:Cocoa-dev@lists.apple.com>)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at 
cocoa-dev-admins(at)lists.apple.com<http://lists.apple.com>

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com

This email sent to luket...@apple.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to