1.cell 在subview中的位置
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSInteger sectionIndex = indexPath.section;
NSInteger cellIndex = indexPath.row;
//cell在tableview中坐标
CGRect cellRectInTableview = [tableView rectForRowAtIndexPath:indexPath];
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
//cell在window中的位置
CGRect cellRectInWindow = [cell convertRect:cell.bounds toView:nil];
//cell在selfview中的位置
CGRect cellRectInSelfView = [cell convertRect:cell.bounds toView:self.view];
}
获取btn所在的cell indexPath
- (void) init
{
[cell.btn addTarget:self
action:@selector(btnClick:event:)
forControlEvents:UIControlEventTouchUpInside];
}
- (void)btnClick:(id)sender event:(id)event {
NSSet *touches =[event allTouches];
UITouch *touch =[touches anyObject];
CGPoint position = [touch locationInView:self.tableView];
NSIndexPath * indexPath = [self.tableView indexPathForRowAtPoint:position];
if (indexPath!= nil) {
// ....
}
}
//bgview Y移动200dp
self.bgView.transform = CGAffineTransformMakeTranslation(0, -200);
//topTransformView顺时针旋转1.5π
self.topTransformView.transform = CGAffineTransformMakeRotation(M_PI*1.5);