Hi Torsten,
On Jun 11, 2014, at 6:26 AM, Torsten Curdt <[email protected]> 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 protected])
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 [email protected]