Ios 添加滑动手势以显示详细视图中的下一项-修订
这是我先前的问题 我以前问过这个问题,但不知道如何用我的进度来更新它 我采纳了一些建议,但现在我又被卡住了 现在我想向目标视图控制器添加一个滑动手势,这样我就可以在不返回主页的情况下阅读下一篇文章。我已经添加了以下设置手势的功能,以及加载数组中项目的功能 所有这些数据都已通过segue传递到ViewControllerIos 添加滑动手势以显示详细视图中的下一项-修订,ios,objective-c,uigesturerecognizer,segue,Ios,Objective C,Uigesturerecognizer,Segue,这是我先前的问题 我以前问过这个问题,但不知道如何用我的进度来更新它 我采纳了一些建议,但现在我又被卡住了 现在我想向目标视图控制器添加一个滑动手势,这样我就可以在不返回主页的情况下阅读下一篇文章。我已经添加了以下设置手势的功能,以及加载数组中项目的功能 所有这些数据都已通过segue传递到ViewController -(IBAction)swipeHandler:(UISwipeGestureRecognizer *)gesture{ { [self loadArticleForIn
-(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];
}
-(iAction)swipeHandler:(UISwipegestureRecognitor*)手势{
{
[self-loadArticleForIndex:_-articleListsports.count];
NSLog(“刷卡”);
NSLog(@“找到%d个字符)”,[\u articleListsports count]);
}
-(void)loadArticleForIndex:(int)索引
{
//绘制您的文章或加载您的网络视图。
如果(index>0&&index您从未更改您传递的索引:
[self loadArticleForIndex:_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;
}
}
可能是重复的,那么你发布的代码有什么问题吗?它会给你什么结果?我得到的唯一结果是从日志文件中得到的,说明我在队列中的数量以及已检测到的刷击。@voromax这是重复的。但我在顶部指出了。我不确定如何再编辑该结果以显示我上面的更新…@RobertFarr重复的问题应该通过链接链接(无论你是否声明)我如何设置你所说的这个索引?
[self loadArticleForIndex:currentIndex++];