UIScrollView的正确使用方法
2012-05-10 15:32
375 查看
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.
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.
相关文章推荐
- UIScrollView的正确使用方法
- UIScrollView的使用及方法的详细介绍
- UIScrollView的监听方法和定时器的使用
- [转]IOS 学习笔记(8) 滚动视图(UIScrollView)的使用方法
- UIScrollView的属性,方法使用小结
- 使用ViewModel模式来简化WPF的TreeView(用正确的方法使用TreeView)(转)
- 了解iPhone应用中UIScrollView的使用方法
- iOS滚动视图UIScrollView使用方法
- ios UIScrollView代理方法追踪 及使用
- Android ListView在增加HeaderView之后使用getLocationInWindow和getLocationOnScreen获得值不正确的解决方法
- iPhone编程:UIScrollView的使用方法
- UI 基础----UIScrollView 的基本属性使用以及代理的使用方法
- 【iOS7的一些总结】13、UIScrollView的概念和基本使用方法
- [How to] UIScrollView的使用方法
- ios UIScrollView代理方法追踪 及使用
- UIScrollView的使用方法
- ios UIScrollView代理方法追踪 及使用
- 使用Unity3D时,UIScrollView不滚动问题的解决方法
- iPhone编程:UIScrollView的使用方法
- ios菜鸟之路:uiscrollview和pagecontrol的使用方法