方法不通过第二次工作:SVPullToRefresh

所以,我在这里描述的问题上取得了一些进展 – https://stackoverflow.com/questions/27348458/svpulltorefresh-infinite-scroll-with-an-rss-feed

不过,我有一个问题。 该表最初加载10个YouTubevideo。 然后,第二个十将加载使用

__weak MasterViewController *weakSelf = self; [self.tableView addInfiniteScrollingWithActionHandler:^{ NSLog(@"Infinite Scroll"); [weakSelf updateVideoList]; }]; 

– (void)updateVideoList实质上将10个项目添加到加载到表视图的数组中(在addObjectsFromArray将项添加到初始数组后,在tableview上调用reloadData)。 这工作得很好。 问题是,试图加载第三个10项不起作用。 我添加了NSLog,看看它是否进入方法第二次,而不是。

该方法是否有任何理由不能再次工作?

编辑这里的updateVideoList,但我用日志来确定该方法甚至不被称为第二次通过:

 - (void) updateVideoList { NSString *baseDomain = @"https://gdata.youtube.com/feeds/api/videos"; NSString *maxresults = @"10"; NSString *startIndex = [NSString stringWithFormat:@"%lu", (unsigned long)videoList.count+1]; NSString *orderBy = @"published"; NSString *author = @"theverge"; NSString *extension = @"v=2&alt=jsonc"; NSString *urlYoutube = [NSString stringWithFormat:@"%@?max-results=%@&start-index=%@&orderby=%@&author=%@&%@", baseDomain,maxresults, startIndex,orderBy,author,extension]; NSDictionary *listOfVideos = [JSONParser listOfVideos:urlYoutube]; int videoListSize = [[[listOfVideos valueForKey:@"data"] valueForKey:@"totalItems"] intValue]; if (videoListSize>0) { NSMutableArray *secondYoutubeList = [[NSMutableArray alloc] init]; NSArray *arrayVideoList = [[listOfVideos valueForKey:@"data"] valueForKey:@"items"]; for (NSDictionary *videoDictionary in arrayVideoList) { NSString *idVideo = [videoDictionary valueForKey:@"id"]; NSString *description = [videoDictionary valueForKey:@"description"]; //NSString *updated = [videoDictionary valueForKey:@"updated"]; // NSString *departTimeDate = [videoDictionary valueForKey:@"updated"]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"]; //NSDate *date = [dateFormatter dateFromString:departTimeDate]; NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:[NSDate date]]; NSInteger day = [components day]; NSInteger month = [components month]; NSInteger year = [components year]; NSString *updated = [NSString stringWithFormat:@"%ld, %ld, %ld", (long)month,(long)day,(long)year]; NSString *duration = [videoDictionary valueForKey:@"duration"]; NSString *title = [videoDictionary valueForKey:@"title"]; // If we are using wifi, take hqDefault NSString *thumbnail = [[videoDictionary valueForKey:@"thumbnail"] valueForKey:@"hqDefault"]; YoutubeVideo *video = [[YoutubeVideo alloc] initWithId:idVideo withDescription:description withUpdated:updated withDuration:duration withTitle:title withThumbnail:thumbnail]; [secondYoutubeList addObject:video]; } [videoList addObjectsFromArray:secondYoutubeList]; [self.tableView reloadData]; } } 

你应该打电话

[self.tableView.infiniteScrollingView stopAnimating];

一旦你的重新加载工作完成。