UITableView 崩溃问题
- return [UITableView new];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPat
if (indexPath.row < _cellArray.count) {
ProjectCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
return cell;
}
else {
return [UITableViewCell new];
}
}
复制代码
- 上下拉刷新
- 上拉刷新停止下拉加载
- 下拉加载停止上拉刷新
UITableView系统自己做的不完善的
iOS7上tableview的分割线左边短了一点,用这个方法来解决
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
但是在ios8中,设置setSeparatorInset:UIEdgeInsetsZero 已经不起作用了。
下面是解决办法
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
}
复制代码
未完待续