IOS 基础入门轮播图

Spanner轮播图

使用

//
//  ViewController.m
//  Banner轮播
//
//  Created by clz on 2019/10/5.
//  Copyright © 2019 clz. All rights reserved.
//

#import "ViewController.h"
#import <SDCycleScrollView.h>
#import <Masonry.h>

@interface ViewController ()<SDCycleScrollViewDelegate>

@property(nonatomic,strong)SDCycleScrollView *cycleScrollView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    

    NSMutableArray *images = [[NSMutableArray alloc]init];
    UIImage *image1 = [UIImage imageNamed:@"banner01"];
    UIImage *image2 = [UIImage imageNamed:@"banner02"];
    UIImage *image3 = [UIImage imageNamed:@"banner02"];
    [images addObject:image1];
    [images addObject:image2];
    [images addObject:image3];

    
//    self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageNamesGroup:images];
    
    self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImage imageNamed:@"banner01"]];
    NSMutableArray *imageURLS = [[NSMutableArray alloc]init];
    [imageURLS addObject:@"http://image1.png"];
    [imageURLS addObject:@"http://image1.png"];
    [imageURLS addObject:@"http://image1.png"];
    [imageURLS addObject:@"http://image1.png"];


    self.cycleScrollView.imageURLStringsGroup = imageURLS;

    
    
    [self.view addSubview:self.cycleScrollView];
    [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.view);
        make.height.equalTo(self.cycleScrollView.mas_width).multipliedBy(0.625);
    }];
    
    
    
    
}


- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    
}


@end

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值