1

我正在使用 UIScrollView 进行测试,并在其中放置了一个 UILabel 。关键是我试图滚动到底部以阅读整个 UIlabel,但是一旦我停止向上拖动,滚动视图就会返回(橡皮筋效果)并且我无法阅读最后三行文本。

scrollView.backgroundColor = [UIColor redColor];
scrollView.contentSize = CGSizeMake(320, 600);



UILabel *lbltestScroll = [[UILabel alloc]initWithFrame:CGRectMake(0,100,320,600)];

lbltestScroll.text =@"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.";

lbltestScroll.lineBreakMode = UILineBreakModeWordWrap; 
lbltestScroll.numberOfLines = 0;

[scrollView addSubview:lbltestScroll];

哪里有问题?

谢谢卢卡

4

1 回答 1

-1

滚动视图的 contentSize 太小。

由于标签的大小与滚动视图的内容大小相同,但它位于 0、100,它不适合滚动视图内的可用空间。contentSize 属性与滚动视图(您正在查看的“窗口”)的实际大小无关,而是设置可用于显示内容的“画布”的大小,或多或少多远你可以滚动。

于 2012-05-29T14:28:30.263 回答