IOS学习开发笔记(三)-----初识UIScrollView
2015-08-18 22:36
543 查看
移动设备的屏幕是有限的,因此直接呈现在用户面前的内容是有限的,当我们需要展现较多内容的时候,必须要让屏幕滚动起来,才能让用户看到超出一屏外的内容。
UIScrollView是一个能够滚动的视图控件,可以用来展示大量的内容,并且可以通过滚动查看所有的内容。
一、UIScrollView的基本使用。
1.首先在将需要展示的内容添加到UIScrollView中。
2.设置UIScrollView的contentSize属性:
二、UIScrollView的常见属性
表示ScrollView是否可以回弹
三、UIScrollView使用的注意事项
当发现UIScrollView无法使用时,可以从以下的几个方面去考虑:
1.没有设置UIScrollView的contentSize;
2.scrollViewEnabled = No;
3.没有接收到触摸时间:userInteractionEnabled = No;
UIScrollView是一个能够滚动的视图控件,可以用来展示大量的内容,并且可以通过滚动查看所有的内容。
一、UIScrollView的基本使用。
1.首先在将需要展示的内容添加到UIScrollView中。
2.设置UIScrollView的contentSize属性:
//设置contentSize,即ScrollView的滚动范围 self.scrollView.contentSize = self.imageView.frame.size;这样,UIScrollView就可以在滚动范围(imageView)内进行滚动了。
二、UIScrollView的常见属性
@property(nonatomic) CGPoint contentOffset;表示ScrollView的偏移位置
@property(nonatomic) CGSize contentSize;表示ScrollView的内容尺寸,即滚动范围
@property(nonatomic) UIEdgeInsets contentInset;表示ScrollView的内边距,类似于Android或者CSS中的padding属性
@property(nonatomic) BOOL bounces;
表示ScrollView是否可以回弹
@property(nonatomic) BOOL showsHorizontalScrollIndicator表示ScrollView是否显示水平方向的滚动条
@property(nonatomic) BOOL showsVerticalScrollIndicator表示ScrollView是否显示垂直方向的滚动条
三、UIScrollView使用的注意事项
当发现UIScrollView无法使用时,可以从以下的几个方面去考虑:
1.没有设置UIScrollView的contentSize;
2.scrollViewEnabled = No;
3.没有接收到触摸时间:userInteractionEnabled = No;
相关文章推荐
- 新手笔记之关键字return、break和continue的用法
- pat(A)1041. Be Unique(哈希)
- GUID介绍
- UIP协议栈四
- UIP协议栈三
- UIP协议栈二
- UIP协议一
- 高效e人注册码 EfficientPIM Pro 5.0 Build 505
- HDU 1711 Number Sequence(KMP算法)
- HDU 1711 Number Sequence(KMP算法)
- scala学习之:ListBuffer、ArrayBuffer、Queue、Stack的操作代码实战
- Android UI设计的三种常见布局(LinearLayout、RelativeLayout、FrameLayout)
- hdu 5400 Arithmetic Sequence(水题一道)
- POJ1776 Task Sequences
- hdu 1159 Common Subsequence
- required string parameter XXX is not present
- required string parameter XXX is not present
- required string parameter XXX is not present
- Result Maps collection already contains value for **
- Codeforces Gym 100650D Queens, Knights and Pawns 暴力