Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewDidLoad {
- [super viewDidLoad];
- PostWithHeaderView *postView = [[PostWithHeaderView alloc] initWithFrame:CGRectMake(0, 0, 320, CGFLOAT_MAX)];
- postView.post = self.post;
- self.tableView.tableHeaderView = postView;
- }
- - (void)viewDidLayoutSubviews {
- [super viewDidLayoutSubviews];
- UIView *postView = self.tableView.tableHeaderView;
- [postView setNeedsLayout];
- [postView layoutIfNeeded];
- CGFloat height = [postView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
- NSLog(@"HEIGHT %f",height);
- //update the header's frame and set it again
- CGRect headerFrame = postView.frame;
- headerFrame.size.height = height;
- postView.frame = headerFrame;
- self.tableView.tableHeaderView = postView;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement