2012-05-29 65 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屬性與滾動視圖的實際大小(您正在瀏覽的「窗口」)無關,而是設置可用於顯示內容的「畫布」的大小,並且或多或少有多遠你可以滾動。