我努力尝试,但无法在启用分页的另一个水平滚动视图中添加垂直滚动视图。我尝试寻找解决方案,但没有任何帮助。请帮忙。谢谢。以下是我尝试过的代码:
for (int i = 0; i < kNumImages; i++) {
NSString *imageName = [NSString stringWithFormat:@"dots.png"];
UIImage *image = [UIImage imageNamed:imageName];
UIScrollView *insetScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
insetScrollView.scrollEnabled = NO;
UIView *insetView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(320*i, 300, 300, 21)];
textLabel.backgroundColor = [UIColor clearColor];
textLabel.text = @"MyRandomText";
UIImageView *imageButton = [[UIImageView alloc] initWithImage:image];
imageButton.frame = CGRectMake(320*i, 0, 320, 260);
[insetView addSubview:imageButton];
[insetView addSubview:textLabel];
[insetScrollView addSubview:insetView];
[mainScrollView addSubview: insetScrollView];
[mainScrollView setDelegate:self];
[self.view addSubview:mainScrollView];
}