如何左右滑动在iOS中的桌面视图sdk
问题描述:
我想做一个tableview,其中我想作业将更改左右滑动。 默认情况下在iPhone刷卡是删除,所以我怎么做到这一点。 我使用过这种手势,但它在tableview中看起来没有任何转换,只需滑动即可,我想要滑动转换将显示为我们正在交换。如何左右滑动在iOS中的桌面视图sdk
请帮忙!
答
方法向左扫
UISwipeGestureRecognizer * swipeleft=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeleft:)];
swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
[yourtableviewName addGestureRecognizer:swipeleft];
方法向右滑动
UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(swiperight:)];
[gesture setDirection:UISwipeGestureRecognizerDirectionRight];
[tblvie addGestureRecognizer:gesture];
向左扫动作方法
-(void)swipeleft:(UISwipeGestureRecognizer*)recognizer
{
int tag = (int)recognizer.view.tag; // assign the tag if u need
if (tag==40)
{
// call the another function
}
else
{
// call the some another function
}
[yourtableview reloadData];
}
向右滑动操作方法
-(void)swiperight:(UISwipeGestureRecognizer*)recognizer
{
int tag = (int)recognizer.view.tag; // assign the tag if u need
if (tag==40)
{
// call the another function
}
else
{
// call the some another function
}
[yourtableview reloadData];
}
如果u需要任何帮助,我用U当然希望 – 2014-11-05 06:06:30
THanku庵埠,但我用这个代码,但我绝对不想转变,因为tableview中是不是看起来swap..but它交换编程我们应该如何看待从左到右的过渡 – Jason 2014-11-05 06:40:46
哦,那么你需要就像Sefi发布的答案 – 2014-11-05 06:45:10