获取tableView(collection)中某一个cell相对于屏幕的frame

在tableView 中

获取cell相对于tableView的frame
CGRect rectInTableView = [tableView rectForRowAtIndexPath:indexPath];
 获取相对于self.view的frame
CGRect rect = [tableView convertRect:rectInTableView toView:[tableView superview]]; 

在collection中

    CGRect cellInCollection = [_collection convertRect:cell.frame toView:_collection];
    //获取cell在当前屏幕的位置
    CGRect cellInSuperview =  [_collection convertRect:cellInCollection toView:self.view];

你可能感兴趣的:(获取tableView(collection)中某一个cell相对于屏幕的frame)