i had an array which is contains 10 items which is 1,2,3,4,5,6,7,8,9,10. when i load the page the item is at 3. so when the user swipe left it will go to 4 and swipe to right it will go to 2. may i know how to do it?
newsID=[[NSMutableArray alloc]init];
[newsID addObject:@"1"];
[newsID addObject:@"2"];
[newsID addObject:@"3"];
[newsID addObject:@"4"];
[newsID addObject:@"5"];
[newsID addObject:@"6"];
[newsID addObject:@"7"];
[newsID addObject:@"8"];
[newsID addObject:@"9"];
[newsID addObject:@"10"];
UISwipeGestureRecognizer * swipeleft=
[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeleft:)];
swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeleft];
UISwipeGestureRecognizer * swiperight=
[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swiperight:)];
swiperight.direction=UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swiperight];
Try this. i am taking one UILabel and changing the text of it while swiping.and one int variable to keep track of swipe.