Giter VIP home page Giter VIP logo

zxyshowimageview's Introduction

ZXYShowImageView

使用ZXYShowImageView

三步完成主流App框架搭建:

  • 第一步:使用CocoaPods导入ZXYShowImageView
  • 第二步:设置ZXYShowImageView的两个数组:图片URL数组和图片信息数组,并将ZXYShowImageView加到view上
  • 第三步(可选):隐藏PageControl和图片信息控件

第一步:使用CocoaPods导入ZXYShowImageView

CocoaPods 导入

在文件 Podfile 中加入以下内容:

pod 'ZXYShowImageView'

然后在终端中运行以下命令:

pod install

或者这个命令:

  禁止升级 CocoaPods 的 spec 仓库,否则会卡在 Analyzing dependencies,非常慢
    pod install --verbose --no-repo-update
  或者
    pod update --verbose --no-repo-update

完成后,CocoaPods 会在您的工程根目录下生成一个 .xcworkspace 文件。您需要通过此文件打开您的工程,而不是之前的 .xcodeproj。

第二步:设置ZXYShowImageView的两个数组:图片URL数组和图片信息数组,并将ZXYShowImageView加到view上

    NSArray *arr = @[@"http://img.zcool.cn/community/0142135541fe180000019ae9b8cf86.jpg",
                     @"http://img.zcool.cn/community/01f09e577b85450000012e7e182cf0.jpg",
                     @"http://img.zcool.cn/community/010f87596f13e6a8012193a363df45.jpg",
                     @"http://img.zcool.cn/community/018d4e554967920000019ae9df1533.jpg",
                     @"http://img.zcool.cn/community/010a1b554c01d1000001bf72a68b37.jpg",
                     @"http://pic.58pic.com/58pic/15/57/84/70H58PICCJt_1024.jpg"
                     ];
    NSArray *arr1 = @[@"第一张图",
                      @"第二张图",
                      @"第三张图",
                      @"第四张图",
                      @"第五张图",
                      @"第六张图"];
    
    ZXYScrollView *scrollView = [[ZXYScrollView alloc] initWithFrame:CGRectMake(0, BARFRAME_NAVBAR_HEIGHT, [UIScreen mainScreen].bounds.size.width, 200)];
    scrollView.delegate = self;
    [scrollView setUpViewWithImageUrls:arr imgage:arr1];
    [self.view addSubview:scrollView];

第三步(可选):隐藏PageControl和图片信息控件

    scrollView.isPageControl = YES; 默认都为YES,设为NO隐藏控件
    scrollView.isMessageLabel = YES;

实现代理方法

获取点击的图片的id

   - (void)successClickDelegate:(NSInteger)num{


      NSLog(@"----------%ld ---- %@",num,arr1[num]);
  }

zxyshowimageview's People

Contributors

xiaoyezhang avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.