iOS 常用小代码整理

一、View想关操作

  1. 判断两个View是否是另一个View的子View
  BOOL res = [view isDescendantOfView:self.view];
  1. 判断当前Cell是否显示
  - (BOOL)isShowCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath {
    CGRect rect = [tableView rectForRowAtIndexPath:indexPath];
    return CGRectIntersectsRect(tableView.bounds, rect);
}

你可能感兴趣的:(iOS 常用小代码整理)