Re: Adding subviews to UITableViewCell's contentView and autoresizing behavior
Re: Adding subviews to UITableViewCell's contentView and autoresizing behavior
- Subject: Re: Adding subviews to UITableViewCell's contentView and autoresizing behavior
- From: Luke Hiesterman <email@hidden>
- Date: Thu, 03 Mar 2011 21:29:19 -0800
The strategy I recommend for anyone adding views to UITableViewCell is to subclass and implement layoutSubviews. You will then be able to easily set your subview frames as you desire for any orientation because layoutSubviews will be called on rotation.
Luke
On Mar 3, 2011, at 8:50 PM, Ray <email@hidden> wrote:
>> Flexible width means "change my width if my superview's width changes" and accessory views cause the contentView to shrink from its original state as the full width of the cell (since the contentView must make space for the accessoryView). Therefore, your subview auto shrinks with it since you set the mask. Make sense?
>>
>> Luke
>
> Thanks for your fast reply, Luke!
>
> It does makes sense. I wanted to use the autoresizing mask because it supports rotation (of the device) in a nice way for my subview (initially I used an animation to adjust the width of the subview, but I wanted to make things simpler). Because my fixed-width accessoryView will always be there (in my cell's implementation in the real app that is), would you consider it good practice to take into account the offset in defining my subview's width, if you know what I mean?
>
> Thanks,
> - Ray.
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden