底部UIScrollView无限滚动ios
我试图在屏幕底部制作无限滚动。我所做的是 我已经创建了8个按钮,必须使其在按钮7->按钮0->按钮1之后无限滚动。。。。我不知道下一步该怎么办。 下面是我所做的代码底部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)];
- (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度,您也可以添加水平表格。