【问题标题】:UISCrollView can't see bottom part cause it returns at the topUISCrollView 看不到底部,因为它在顶部返回
【发布时间】:2012-05-29 14:24:59
【问题描述】:

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

问题出在哪里?

谢谢 卢卡

【问题讨论】:

    标签: uiscrollview uilabel


    【解决方案1】:

    滚动视图的 contentSize 太小了。

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

    【讨论】:

      猜你喜欢
      • 2017-11-19
      • 2011-12-04
      • 2013-10-17
      • 1970-01-01
      • 2023-04-07
      • 2015-11-21
      • 1970-01-01
      • 2013-06-03
      • 1970-01-01
      相关资源
      最近更新 更多