Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
底部UIScrollView无限滚动ios_Ios_Uiscrollview - Fatal编程技术网

底部UIScrollView无限滚动ios

底部UIScrollView无限滚动ios,ios,uiscrollview,Ios,Uiscrollview,我试图在屏幕底部制作无限滚动。我所做的是 我已经创建了8个按钮,必须使其在按钮7->按钮0->按钮1之后无限滚动。。。。我不知道下一步该怎么办。 下面是我所做的代码 - (void)viewDidLoad { [super viewDidLoad]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 450, self.view.frame.size.width, 35)];

我试图在屏幕底部制作无限滚动。我所做的是 我已经创建了8个按钮,必须使其在按钮7->按钮0->按钮1之后无限滚动。。。。我不知道下一步该怎么办。 下面是我所做的代码

- (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];

}

一个简单的解决方案是在您的案例中使用带有n的UITableView 8行,当显示第8行时,在其中显示按钮0等。

实际上我正在水平滚动。然后将tableview旋转90度,您也可以添加水平表格。