• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UITableView's tableFooterView and autolayout
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UITableView's tableFooterView and autolayout


  • Subject: Re: UITableView's tableFooterView and autolayout
  • From: Sebastian Celis <email@hidden>
  • Date: Wed, 11 Jun 2014 08:56:12 -0500

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


  • Follow-Ups:
    • Re: UITableView's tableFooterView and autolayout
      • From: Torsten Curdt <email@hidden>
References: 
 >UITableView's tableFooterView and autolayout (From: Torsten Curdt <email@hidden>)

  • Prev by Date: Re: document inexplicably becomes locked and fails to save under sandboxing
  • Next by Date: Re: UIKit and Swift
  • Previous by thread: UITableView's tableFooterView and autolayout
  • Next by thread: Re: UITableView's tableFooterView and autolayout
  • Index(es):
    • Date
    • Thread