GithubHelp home page GithubHelp logo

buddax2 / ksphotobrowser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skx926/ksphotobrowser

0.0 1.0 0.0 31.62 MB

A beautiful photo browser with interactive dismissal animation.一个小而美的图片浏览器。

Home Page: https://github.com/skx926/KSPhotoBrowser

License: MIT License

Ruby 12.36% Objective-C 87.64%

ksphotobrowser's Introduction

KSPhotoBrowser

License MIT  CocoaPods  CocoaPods  Support 

A beautiful photo browser with interactive dismissal animation.

Rotation~
Blur~
Scale~

Features

  • 4 different interactive dismissal animations(Rotation, Scale, Slide).
  • 3 different background styles(Blur Photo, Blur, Black).
  • 2 different loading styles(Determinate, Indeterminate).
  • 2 different pager styles(Dot, Text).
  • Support bounce animation.
  • Optimized for image which has a very large height.
  • Can display one or more images by providing either image urls or UIImage objects.
  • Custom image downloader library support.

Follow-up

  • Support Landscape orientation browse.
  • Support video browse.

Usage

Display images from urls

NSArray *urls = @[@"http://ww4.sinaimg.cn/bmiddle/a15bd3a5jw1f12r9ku6wjj20u00mhn22.jpg",
                  @"http://ww2.sinaimg.cn/bmiddle/a15bd3a5jw1f01hkxyjhej20u00jzacj.jpg"];
NSMutableArray *items = @[].mutableCopy;
for (int i = 0; i < urls.count; i++) {
    // Get the large image url
    NSString *url = [urls[i] stringByReplacingOccurrencesOfString:@"bmiddle" withString:@"large"];
    UIImageView *imageView = _imageViews[i];
    KSPhotoItem *item = [KSPhotoItem itemWithSourceView:imageView imageUrl:[NSURL URLWithString:url]];
    [items addObject:item];
}
KSPhotoBrowser *browser = [KSPhotoBrowser browserWithPhotoItems:items selectedIndex:0];
[browser showFromViewController:self];

Display images from UIImage objects

NSArray *names = @[@"a.jpg", @"b.jpg"];
NSMutableArray *items = @[].mutableCopy;
for (int i = 0; i < names.count; i++) {
    UIImageView *imageView = _imageViews[i];
    KSPhotoItem *item = [KSPhotoItem itemWithSourceView:imageView image:[UIImage imageNamed:names[i]]];
    [items addObject:item];
}
KSPhotoBrowser *browser = [KSPhotoBrowser browserWithPhotoItems:items selectedIndex:0];
[browser showFromViewController:self];

Installation

Cocoapods

  1. Update cocoapods to the latest version.
  2. Add pod 'KSPhotoBrowser' to your Podfile.
  3. Run pod install or pod update.
  4. Import KSPhotoBrowser.h.

Manually

  1. Download all the files of KSPhotoBrowser and add source files to your project.
  2. Manually install YYWebImage to your project.
  3. Import KSPhotoBrowser.h.

Custom Image Downloader

It use YYWebImage as default image downloader, you can also use your custom image downloader like SDWebImage, Kingfisher and so on.

To use a custom image downloader, you need to create a class and make it conforms to KSImageManager protocol and implement those methods inside that protocol.

For convenience, I have already created KSSDImageManager to support SDWebImage 4.0 as an example in the demo, you can also use it directly.

Finally, just use the code below to set your class to KSPhotoBrowser before you use the browser to show images.

[KSPhotoBrowser setImageManagerClass:KSSDImageManager.class]

Requirements

This library requires iOS 8.0+ and Xcode 8.0+.

License

KSPhotoBrowser is provided under the MIT license. See LICENSE file for details.

中文介绍

查看中文介绍

ksphotobrowser's People

Contributors

skx926 avatar

Watchers

 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.