2.23 Creating Scrollable Content with UIScrollView
来源:互联网 发布:最优化导论中文版 编辑:程序博客网 时间:2024/04/27 10:21
他是一个UIView,你可以像对待UIView一样对待它。
你需要特别注意的是他的contentSize 属性,如果没设置好,他将不会滚屏(contentSize应该大于UIScrollView 的size)。
UIScrollViewDelegate 滚动代理
scrollViewDidScroll:当被滚动了就会触发,也就是在滚动过程中会一直触发的
scrollViewWillBeginDecelerating:开始减速,在手机离开屏幕时触发
scrollViewDidEndDecelerating: 结束减速,滚动停止时触发,结束滚屏
scrollViewDidEndDragging:willDecelerate:结束拖拽,这个方法有些像结束滚屏。区别:滚屏是那种,手指快速划一下,然后让屏幕滚一会的那种;拖拽就是把显示的内容拖过来一点,没有让屏幕滚的。
试了几个消息代理,做了一次滚屏操作,触发顺序如下
2013-11-11 10:08:45.478 SingleViewWithOutStoryboards[437:c07] will Begin Dragging
2013-11-11 10:08:45.481 SingleViewWithOutStoryboards[437:c07] Did Scroll
2013-11-11 10:08:45.494 SingleViewWithOutStoryboards[437:c07] Did Scroll
2013-11-11 10:08:45.512 SingleViewWithOutStoryboards[437:c07] Did Scroll
2013-11-11 10:08:45.517 SingleViewWithOutStoryboards[437:c07] Will End Dragging
2013-11-11 10:08:45.517 SingleViewWithOutStoryboards[437:c07] Did End Dragging
2013-11-11 10:08:45.518 SingleViewWithOutStoryboards[437:c07] Will Begin Decelerating
2013-11-11 10:08:45.535 SingleViewWithOutStoryboards[437:c07] Did Scroll
2013-11-11 10:08:45.552 SingleViewWithOutStoryboards[437:c07] Did Scroll
2013-11-11 10:08:45.569 SingleViewWithOutStoryboards[437:c07] Did Scroll
2013-11-11 10:08:45.586 SingleViewWithOutStoryboards[437:c07] Did Scroll
2013-11-11 10:08:45.602 SingleViewWithOutStoryboards[437:c07] Did Scroll
......
2013-11-11 10:08:47.319 SingleViewWithOutStoryboards[437:c07] Did End Decelerating
不过有时在找联系人时,会用力一划,滚到快到那个联系人了,赶紧按住。试了一下,结果如下
2013-11-11 10:27:19.533 SingleViewWithOutStoryboards[481:c07] will Begin Dragging
2013-11-11 10:27:19.534 SingleViewWithOutStoryboards[481:c07] Did Scroll
2013-11-11 10:27:19.541 SingleViewWithOutStoryboards[481:c07] Will End Dragging
2013-11-11 10:27:19.542 SingleViewWithOutStoryboards[481:c07] Did End Dragging
2013-11-11 10:27:19.542 SingleViewWithOutStoryboards[481:c07] Will Begin Decelerating
2013-11-11 10:27:19.560 SingleViewWithOutStoryboards[481:c07] Did Scroll
2013-11-11 10:27:19.577 SingleViewWithOutStoryboards[481:c07] Did Scroll
2013-11-11 10:27:19.593 SingleViewWithOutStoryboards[481:c07] Did Scroll
......
2013-11-11 10:27:19.902 SingleViewWithOutStoryboards[481:c07] will Begin Dragging
2013-11-11 10:27:20.830 SingleViewWithOutStoryboards[481:c07] Will End Dragging
2013-11-11 10:27:20.831 SingleViewWithOutStoryboards[481:c07] Did End Dragging
2013-11-11 10:27:20.844 SingleViewWithOutStoryboards[481:c07] Did End Decelerating
滚动条样式
indicatorStyle
typedef NS_ENUM(NSInteger, UIScrollViewIndicatorStyle) {
UIScrollViewIndicatorStyleDefault, // black with white border. good against any background
UIScrollViewIndicatorStyleBlack, // black only. smaller. good against a white background
UIScrollViewIndicatorStyleWhite // white only. smaller. good against a black background
};
翻页
pagingEnabled boolean
我们在浏览照片的时候,会翻页一张一张的看,pagingEnabled 就是用来指定要实现这样的效果。
- 2.23 Creating Scrollable Content with UIScrollView
- Creating a Scrollable DataGrid...
- 【IOS学习之常见问题】UIScrollView 不能滑动(ScrollView has ambiguous scrollable content height)
- Has ambiguous scrollable content width/hight
- ios has ambiguous scrollable content height
- Creating a Content Provider
- Creating a Content Provider
- Error creating bean with name 'com.mycompany.content.service.ContentCategoryService': Cannot resolve
- IOS Scroll View has ambiguous scrollable content height / width
- do you have "has ambiguous scrollable content width and height"
- Content Provider 之Creating a Content Provider
- CREATING A NEW CONTENT PROVIDER
- Creating Custom Content View Controllers
- android-Creating a Content Provider
- UIScrollView的Content Size, Content Inset属性
- Creating tables with PDFBox
- Creating Views with Ionic
- Creating Concurrency with Threads
- Java中数组排序函数
- java(20130731)反射、单例模式、内存里分四个区域、实例化过程、对象的销毁、命名规范、异常
- Android Intent详解
- UML用例图总结
- android 记事
- 2.23 Creating Scrollable Content with UIScrollView
- 自定义Tabbar方法—
- How to get UITableView from UITableViewCell?
- webservice CXF入门图解 附实例源码
- JavaScript 判斷變量類型的方法
- android中listview的一些样式设置
- 在windows下安装ruby1.9.2,rails和DevKit
- UML类图几种关系的总结
- C#自定义用户控件