This is my previous question Add Swipe Gesture to display the next Item in the Detailed View
I have asked this question before but not sure how to update it with my progress.
I followed some suggestions but now I am stuck again.
I want to now add a swipe gesture to the destination view controller so that I can get to the next article without having to go back to the main page. I have added the following to set up the gesture as well as a function to load the items in the array.
All this data has been passed to the ViewController via segue
-(IBAction)swipeHandler:(UISwipeGestureRecognizer *)gesture{
{
[self loadArticleForIndex:_articleListsports.count];
NSLog(@"SWIPE");
NSLog(@"Found %d character(s).", [_articleListsports count]);
}
- (void)loadArticleForIndex:(int)index
{
//draw ur article or load your webview.
if(index>0 && index <[_articleListsports count])
{
//self.targetURL = selectedCell.targetURL;
self.sdesc = self.sportsdescription.text;
self.stitle = self.sportstitle.text;
self.simage = self.sportsimage.image;
self.scat = self.sportscategory.text;
self.sdate = self.sportsdate.text;
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
UISwipeGestureRecognizer *recognizer;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeHandler:)];
[recognizer setDirection:UISwipeGestureRecognizerDirectionLeft];
[[self view] addGestureRecognizer:recognizer];
NSString *fileName = [NSString stringWithFormat:@"%@/sports.rss", [SPORTSUtil getDocumentRoot]];
_articleListsports = [NSArray arrayWithContentsOfFile:fileName];
}
Now I am stuck and have no clue on how to move forward. Please advise.