2012-05-29 62 views
1

我使用UIScrollView进行测试并将UILabel放入其中。 重点是我想滚动到底部阅读整个UIlabel,但只要我停止拖动滚动视图返回下来(橡皮筋效果),我不能读取最后三行文本。UISCrollView无法看到底部部分,因为它返回顶部

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



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

lbltestScroll.text [email protected]"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]; 

问题在哪里?

由于 卢卡

回答

-1

滚动视图的contentSize太小。

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