判斷當前設備的系統信息io
#define isIOS8 ([[[UIDevice currentDevice] systemVersion] hasPrefix:@"8"])select
iOS8下用下面的方法方法
- (void)setInset:(UITableView *)view cell:(UITableViewCell *)cellview
{vi
if (view !=nil) {return
if ([view respondsToSelector:@selector(setSeparatorInset:)]) {void
[view setSeparatorInset:UIEdgeInsetsZero];ab
}系統
if ([view respondsToSelector:@selector(setLayoutMargins:)]) {
[view setLayoutMargins:UIEdgeInsetsZero];
}
}
if (cell !=nil) {
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
}
在建立cell的地方調用上面的方法
if (isIOS8) {
[self setInset:self.myTableView cell:cell];
}
return cell;