解決UIScrollView 不能滾動的問題


1.最常見的原因是 
  contentSize 這個屬性,比uiscrollview的frame要小, 無需滾動, 自然就滾動不了。 
  scrollenabled 這個屬性,標識着是否允許滾動,要言設成yes 

另外還有一些比較隱蔽的原因. 如果這個scrollView是在IB里面生成的話,還得手動設置它的contentSize,並且不能在initWithNibName:bundle:里面設置,因為The nib file you specify is not loaded right away. It is loaded the first time the view controller’s view is accessed. If you want to perform additional initialization after the nib file is loaded, override theviewDidLoad method and perform your tasks there.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM