2014-02-21 87 views
0

我想在屏幕底部做無限滾動。我做了什麼是 我已經創建了8個按鈕,並且必須使它滾動無限(Button7 - > Button0 - > Button1之後。 ..)。我不知道下一步該做什麼。 這是我所做的代碼。底部UIScrollView無限滾動ios

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 450, self.view.frame.size.width, 35)]; 

    int x = 0; 
    for (int i = 0; i < 8; i++) { 
     UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x, 0, 100, 20)]; 
     [button setTitle:[NSString stringWithFormat:@"Button %d", i] forState:UIControlStateNormal]; 
     button.backgroundColor=[UIColor blackColor]; 
     [scrollView addSubview:button]; 

     x += button.frame.size.width; 
    } 

    scrollView.contentSize = CGSizeMake(x, scrollView.frame.size.height); 
    scrollView.backgroundColor = [UIColor redColor]; 

    [self.view addSubview:scrollView]; 

} 
+3

https://developer.apple.com/library/ios/samplecode/StreetScroller/Introduction/Intro.html和http://stackoverflow.com/questions/19268456/how-can- i-make-uiscrollview-infinite-in-ios – iPatel

回答

0

一種簡單的解決方案將是使用一個與UITableViewÑ(你的情況8)行,並且當行號8被顯示在它等

+0

其實我正在水平滾動。 –

+0

然後旋轉桌面90度 –

+0

您還可以添加水平表。 – AsifHabib

0

圓形滾動視圖顯示按鈕0。檢查這link。 另請檢查蘋果Sample code這裏

+0

不,我不是在尋找頁面滾動。 –

+0

你可以隱藏虛線。那麼 –

+0

查看我上面更新的答案。 –