获取tableViewCell或者collectionViewCell在屏幕上的坐标

//方法一
//返回indexPath指定行的矩形
CGRectrectInTableView = [self.tableViewrectForRowAtIndexPath:indexPath];
//转换坐标系,把某行的坐标以父视图的坐标系为坐标系
**CGRectrectInSuperView = [self.tableViewconvertRect:rectInTableView toView:[self.tableViewsuperview]];
//方法二
UITableViewCell*cell = [self.tableVcellForRowAtIndexPath:indexPath];
CGRectrect = [cellconvertRect:cell.boundstoView:nil];
CGFloaty = rect.origin.y;

你可能感兴趣的:(获取tableViewCell或者collectionViewCell在屏幕上的坐标)