Re: UITableView's tableFooterView and autolayout
Re: UITableView's tableFooterView and autolayout
- Subject: Re: UITableView's tableFooterView and autolayout
- From: Torsten Curdt <email@hidden>
- Date: Wed, 11 Jun 2014 16:41:34 +0200
Thanks but there you are setting the frame yourself. The idea was to
use constraints. Usually you would pin them to the superview. But in
this case...
I tried assigning the footer view and then assigning the constraints
to the super view. It just did not yield the expected results.
cheers,
Torsten
On Wed, Jun 11, 2014 at 3:56 PM, Sebastian Celis
<email@hidden> wrote:
> Hi Torsten,
>
> On Jun 11, 2014, at 6:26 AM, Torsten Curdt <email@hidden> wrote:
>
> So what's the story with tableFooterView and tableHeaderView and
> autolayout? I am trying to put a label into a footer.
>
>
> I have had luck with code like the following:
>
> - (void)viewDidLoad
> {
> [super viewDidLoad];
>
> self.headerView = [[MyView alloc] initWithFrame:CGRectZero];
> }
>
> - (void)viewDidLayoutSubviews
> {
> [super viewDidLayoutSubviews];
>
> CGRect frame = CGRectZero;
> frame.size.width = self.tableView.bounds.size.width;
> frame.size.height = [self.headerView
> systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
> if (self.tableView.tableHeaderView != self.headerView ||
> !CGRectEqualToRect(frame, self.headerView.frame))
> {
> self.headerView.frame = frame;
> [self.headerView layoutIfNeeded];
> self.tableView.tableHeaderView = self.headerView;
> }
> }
>
> - Sebastian
>
_______________________________________________
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