封装好的ScrollVIew库

Home / iOS MrLee 2015-3-3 2761

一个封装好的ScrollView库,用户只需要把界面添加进数组中即可,支持循环滑动。

f7d6bf7e-0da6-39ca-a214-c5faf218e4d0


//
//  CSIIViewController.m
//  ScrollView
//
//  Created by Hu Di on 13-10-11.
//  Copyright (c) 2013年 Sanji. All rights reserved.
//
#import "HDViewController.h"
@interface HDViewController ()
{
    NSMutableArray *imageArray;
    HDScrollview *_scrollview;
}
@end
@implementation HDViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        imageArray=[NSMutableArray arrayWithCapacity:1];
    }
    return self;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"%@",[[UIDevice currentDevice] systemVersion]);
    if ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0) {
        self.edgesForExtendedLayout=UIRectEdgeNone;
    }
    CGRect bound=CGRectMake(0, 0, 320, 150);
    NSArray *color=[[NSArray alloc]initWithObjects:[UIColor redColor],[UIColor brownColor],[UIColor blueColor],[UIColor lightGrayColor], nil];
    NSArray *ImageArr=@[[UIImage imageNamed:@"Expression_1"],[UIImage imageNamed:@"Expression_2"],[UIImage imageNamed:@"Expression_3"],[UIImage imageNamed:@"Expression_4"]];
    for (int i=0; i1) {
        //删除一个
        [imageArray removeObjectAtIndex:index];
        //_scrollview=[_scrollview initWithFrame:_scrollview.frame withImageView:imageArray];
        _scrollview=[_scrollview initLoopScrollWithFrame:_scrollview.frame withImageView:imageArray];
        _scrollview.pagecontrol.currentPage=index;
    }
}
@end

ScrollView循环

本文链接:https://www.it72.com/1203.htm

推荐阅读
最新回复 (0)
返回