BackStory
我正在编写一个ipad应用程序,它的图像可以使用UIScrollView水平滚动。这个很好用。现在,对于每一幅图像,我需要一个UIScrollView,它有一些文本来解释图像。这将是一个垂直scrollView。垂直ScrollView出现,但滚动条不出现。知道为什么吗?代码如下:
CGRect scrollViewFrame = CGRectMake(760, 70, 205, 320);
UIScrollView * contentScrollView = [[UIScrollView alloc]initWithFrame:scrollViewFrame];
[contentView addSubview:contentScrollView];
CGSize scrollViewContentSize = CGSizeMake(205, 100);
[contentScrollView setContentSize:scrollViewContentSize];
[contentScrollView setPagingEnabled:YES];
contentScrollView.delegate = self;
UILabel *titleLable = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 205, 40)];
UILabel *subtitleLable = [[UILabel alloc] initWithFrame:CGRectMake(10, 60, 205, 50)];
UITextView * mainContent = [[UITextView alloc]initWithFrame:CGRectMake(10, 110, 205, 230)];
[titleLable setText:storyTitle];
[subtitleLable setText:storySubTitle];
[contentView setUserInteractionEnabled:YES];
[mainContent setText:storyDescription];另外,主scrolView已经使用Interface添加,并且运行良好。知道为什么会发生这种事吗?
发布于 2012-05-29 15:56:34
滚动视图只显示滚动条,允许用户在内容大小大于滚动视图大小时滚动,正如我在代码中看到的,滚动视图大小为(205,320),而内容大小仅为(205,100)。
https://stackoverflow.com/questions/10802454
复制相似问题