Implement heightForRowIndexPath: in iOS 7, but remove it in iOS 8 using compile-time macro
问题 I'd like to implement the new auto-resizing table view cells in iOS 8, while maintaining support for heightForRowAtIndexPath: in iOS 7. The problem is I have to remove the method override heightForRowAtIndexPath: for iOS 8, but keep in it for iOS 7. Is there some compile-time macro to use that will accomplish this? 回答1: You can not use a compile time macro because this is a run time decision. Instead, you can just return UITableViewAutomaticDimension for iOS 8 and if not, return your