这个滚动视图是直接在ViewController里面实现的,比较简单,
接下来上代码,
首先我们进行一个宏定义
#define WIDTH [[UIScreen mainScreen] bounds].size.width
#define HEIGHT [[UIScreen mainScreen] bounds].size.height
然后签订一个协议UIScrollViewDelegate
然后定义属性(这里根据大家自己的需要来定义)
@property(nonatomic,strong)NSTimer *timer;//定时器
@property(nonatomic,retain)NSMutableArray *arr;//放图片的数组
@property(nonatomic,retain)UIView *headerView;//tableview的表头
@property(nonatomic,retain)UIImageView *image;//放在轮播图里的图片
@property(nonatomic,retain)UIScrollView *scrollView;//定义一个scrollview
@property(nonatomic,retain)UIPageControl *pageC;//定义页码
然后在viewDidload里面写一个
[self headImage];
这里名字可以自己定义
然后我们在ViewDidload外面开始写我们定义的那个方法
这里直接给大家把所有的代码写到一起,
- (void)headImage{
//图片数组
self.arr = [NSMutableArray arrayWithObjects:@"Default3",@"Default2", @"Default1", @"Defau