IOS UItableview移动单元格触摸点

时间:2014-05-12 16:55:10

标签: ios uitableview

我有一个tableview,当我实现委托方法时,可以移动单元格:-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath;

问题是我在每个单元格的最右侧区域有一些按钮,并且由于整个区域响应移动单元格手势,因此无法轻敲它们。有没有办法限制移动细胞的面积? 谢谢。

1 个答案:

答案 0 :(得分:0)

@implementation

NSInteger arrFlags[30];

and in ViewDidLoad{

intialize mutableArray for buttons

_arrButtons=[[NSMutableArray alloc] init];

add ur button into this array 

_bselect  = [ [ UIButton alloc ]  initWithFrame : CGRectMake (270, 15, 20, 20) ] ;

_bselect.tag = indexPath.row ;

[ _arrButtons  addObject : _bselect ] ;

 arrFlags [indexPath.row]  =  0;

in target u jst do what u want...

-(void) buttonTick:(id)sender{

UIButton *clicked=sender;

if (  arrFlags [ clicked.tag ] == 0) 
{

        [[ _arrButtons objectAtIndex:clicked.tag ] setBackgroundImage : [UIImage imageNamed:@"tick.png" ] forState: UIControlStateNormal ];

        arrFlags[clicked.tag] = 1;

    }

else
{

}

// use this  indexpath.row  for  button  array  so  that  each  different  button  will be  selected  

place  ur  buttons  in  the  mutable  array  it  works 


}