Is there an automatic way to be aware of a ContentSize changes in a UITableView/UIScrollView?
The answer is actually simple using KVO (Key Value Observing);
- (id)initWithFrame:(CGRect)frame tableView:(UITableView *)tableView { // .... [self.tableView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionPrior context:NULL]; // .... } - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@"contentSize"]) { // Do something } }
I am not sure about the flags yet though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With