[英]how to left and right swipe in tableview in iOS sdk
我要創建一個表格視圖,在該表格中我希望作業將更改為左右滑動。 在iPhone中,默認情況下刷卡是刪除,所以我該如何做。 我為此使用了手勢,但它在tableview中看起來沒有任何過渡,僅滑動即可,我希望滑動過渡將顯示出我們正在交換的效果。
請幫忙 !
左揮動方法
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];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.