2013-01-18 108 views
0

我正在创建新闻应用程序。要求是这样的。水平滚动无限视图

  1. 显示新闻的列表。用户可以拉取最新的新闻列表。
  2. 当用户选择一条新闻时,它将导航到详细视图。
  3. 在详细视图中。用户可以滑动手指导航到下一个或上一个新闻。

对于要求1,2。那里有很多解决方案。这很容易。 但是对于要求3。我认为这有点困难。假设我们有10条新闻的列表。 我选择第二条新闻以获取其详细视图。如果我从左向右滑动手指,它将导航到第一个新闻视图。当我再次从左向右滑动时。它应该访问该服务以查看是否有最新消息。如果是,那么它应该浏览最新消息。

我想知道是否有任何第三方项目正在做这个逻辑? 任何意见是赞赏!

回答

0

我认为有任何逻辑具体..你将不得不自己创建逻辑。

对于要求1和2,您可以使用此列出的最新消息 - >RevealViewController

对于要求3,您需要添加gesturerecognizer像swipeleft和swiperight。

这是只是一个例子:

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(tappedRightButton:)]; 
    [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft]; 
    [self.view addGestureRecognizer:swipeLeft]; 

    UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(tappedLeftButton:)]; 
    [swipeRight setDirection:UISwipeGestureRecognizerDirectionRight]; 
    [self.view addGestureRecognizer:swipeRight]; 
} 

- (IBAction)tappedRightButton:(id)sender 
{ 
    NSUInteger selectedIndex = [rootVC.tabBarController selectedIndex]; 

    [rootVC.tabBarController setSelectedIndex:selectedIndex + 1]; 
} 

- (IBAction)tappedLeftButton:(id)sender 
{ 
    NSUInteger selectedIndex = [rootVC.tabBarController selectedIndex]; 

    [rootVC.tabBarController setSelectedIndex:selectedIndex - 1]; 
} 

只需修改tappedRightButton和tappedLeftButton accordingly..Hope这有助于逻辑..