One solution would be to override the respondsToSelector:
method in your view controller. Have it return NO
under iOS 8 when checking for the heightForRowAtIndexPath:
method.
- (BOOL)respondsToSelector:(SEL)selector {
static BOOL useSelector;
static dispatch_once_t predicate = 0;
dispatch_once(&predicate, ^{
useSelector = [[UIDevice currentDevice].systemVersion floatValue] < 8.0 ? YES : NO;
});
if (selector == @selector(tableView:heightForRowAtIndexPath:)) {
return useSelector;
}
return [super respondsToSelector:selector];
}
This way, when the table view make a call like:
if ([self.delegate respondsToSelector:@selector(tableView:heightForRowAtIndexPath:)]) {
}
your code will return NO
under iOS 8 or later and YES
under iOS 7 or earlier.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…