I want to make a tableview in which i want jobs will change to swipe left and right . By default in iphone swipe is for delete,so how can i make this. i used gesture for that, but it does not look any transition in tableview,just swipe only,I want swipe transition will show like we are swapping.
Please help !
Method For Left Swipe
UISwipeGestureRecognizer * swipeleft=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeleft:)];
swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
[yourtableviewName addGestureRecognizer:swipeleft];
Method For Right Swipe
UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(swiperight:)];
[gesture setDirection:UISwipeGestureRecognizerDirectionRight];
[tblvie addGestureRecognizer:gesture];
left Swipe Action Method
-(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];
}
Right Swipe Action Method
-(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];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.