I have created a UITableview
with custom UITableViewCell
.The UITableViewCell
contains UILabels
and I have calculated the heig
You also can use KVO to observer tableview's contentSize property and adjust what you need in other views.
Put it somewhere, e.g. in viewDidLoad:
[self.tableView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionInitial context:nil];
Then implement observer:
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (object == self.tableView) {
self.scrollViewHeightConstraint.constant = self.tableView.contentSize.height;
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}