zoukankan      html  css  js  c++  java
  • UIScrollView的正确使用方法

    scrollView 的ContentSize一定要比 它的frame大,否则无法响应滑动的事件

    http://www.iphonedevsdk.com/forum/iphone-sdk-development/102099-uiscrollview-tabbar-application.html

    Let's say you put a scroll view on the screen, and it is 100x100. If the content size is also 100x100, why would it scroll? You can already see everything, there is no reason to scroll.

    Now make them each 200x200. Why would it scroll?

    300x300. Why would it scroll?

    400x400. Why would it scroll? Ah-ha! Now this view is too big to fit on the screen. So what? You said the view is 400x400, you said the content size is 400x400, so why would it scroll? If you take the 100x100 case, and slide it over so that it is half off the screen, why would it scroll? Just because it is partially off screen now? It doesn't work like that.

    So if the view is 100x100, and the content size is 200x200, now you can scroll. You could be looking at the upper left corner, the upper right corner, lower left, lower right, somewhere in the middle, etc. 200x200 does not fit inside 100x100, therefore it can scroll. So the content size has to be larger than the frame, otherwise there is no reason to scroll.

  • 相关阅读:
    设计模式总结
    centos7.5 安装python3.7
    搭建yum软件源
    centos安装gitbook
    编译技术
    samba安装
    docker命令
    shell基础知识
    随笔
    虚拟机字节码执行引擎(三)
  • 原文地址:https://www.cnblogs.com/easonoutlook/p/2642829.html
Copyright © 2011-2022 走看看