以下のメソッドを使う
1 2 3 |
@interface NSObject - (BOOL)respondsToSelector:(SEL)aSelector; @end |
例
1 2 3 |
if ([self.tableView respondsToSelector:@selector(cellLayoutMarginsFollowReadableWidth)]) { self.tableView.cellLayoutMarginsFollowReadableWidth = NO; } |
1 2 3 4 5 6 7 8 9 10 11 |
if ([cell respondsToSelector:@selector(separatorInset)]) { cell.separatorInset = UIEdgeInsetsZero; } if ([cell respondsToSelector:@selector(preservesSuperviewLayoutMargins)]) { cell.preservesSuperviewLayoutMargins = false; } if ([cell respondsToSelector:@selector(layoutMargins)]) { cell.layoutMargins = UIEdgeInsetsZero; } |