UISCrollView无法看到底部因为它返回顶部

时间:2012-05-29 14:25:00

标签: uiscrollview uilabel

我正在使用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];

问题出在哪里?

由于 卢卡

1 个答案:

答案 0 :(得分:-1)

滚动视图的contentSize太小。

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