Giter Club home page Giter Club logo

knphotobrowser's Introduction

image

CocoaPods CocoaPods Support 

KNPhotoBrowser

中文 | English

most like photo or video browser of Wechat(TX) and Weibo(Sina) in China

if you get any function to add, just contact me by E-mail. Welcome to Star

imageimageimageimageimage

Update content

DESCRIPTION STATUS
Base on UIViewController       √
Adapt for rotate of the screen, split screen of iPad       √
Adapt for iPhone5~iPhone13Pro_Max       √
Locate and net image and gif image       √
Locate and net video       √
PanGesture to dismiss or cancel [API]       √
Prefetch image, max is 8 [API]       √
Video player auto play [API]       √
Video player times speed play [API]       √
Video player support play online(no cache,no download) [API]       √
Video player support play after download(it will search next time) [API]       √
Show custom view on PhotoBrowser [API]       √
Show custom view on PhotoBrowser, and set animated following photoBrowser [API]       √
Before the photoBrowser show, all image control can be custom [API]       √
All operation though the delegate [Delegate]       √

1.Before use, you need to know

  • 1.depend SDWebImage(5.0), if need locate gif image, depend SDWebImage(5.8.3)
  • 2.image and video play is ready for use
  • 3.download image or video is ready for use
  • 4.custom control as you wish
  • 5.auto manager image or video of download is finished

2.How to use

(1).init base params

// 1.make every control as an object, put it into an array
KNPhotoItems *items = [[KNPhotoItems alloc] init];
items.url = @"http://xxxxxxxx/xxx.png";
items.sourceView = imageView;
// if current url is video type
// items.isVideo = true;
// if current image is locate gif
// itemM.isLocateGif = true;
[self.itemsArr addObject:items];

(2).init PhotoBrowser

KNPhotoBrowser *photoBrowser = [[KNPhotoBrowser alloc] init];
photoBrowser.itemsArr = [self.itemsArr copy];
photoBrowser.currentIndex = tap.view.tag;

/// photoBrowser will present
[photoBrowser present];

/// photoBrowser will dismiss
/// [photoBrowser dismiss];

(3).function's describe of delegate

photoBrowser will dismiss
/// photoBrowser will dismiss with currentIndex
- (void)photoBrowser:(KNPhotoBrowser *)photoBrowser willDismissWithIndex:(NSInteger)index;
photoBrowser right button did click
/// photoBrowser right top button did click with currentIndex (you can custom you right button, but if you custom your right button, that you need implementate your target action)
- (void)photoBrowser:(KNPhotoBrowser *)photoBrowser rightBtnOperationActionWithIndex:(NSInteger)index;

.....

(4).component of browser : KNPhotoItems

base params of items
/// if it is network image,  set `url` , do not set `sourceImage`
@property (nonatomic,copy  ) NSString *url;

/// if it is locate image, set `sourceImage`, do not set `url`
@property (nonatomic,strong) UIImage *sourceImage;

/// sourceView is current control to show image or video.
/// 1. if the sourceView is kind of `UIImageView` or `UIButton` , just only only only set the `sourceView`.
/// 2. if the sourceView is the custom view , set the `sourceView`, but do not forget set `sourceLinkArr` && `sourceLinkProperyName`.
@property (nonatomic,strong) UIView *sourceView;
custom source View (it is very nice)
@property (nonatomic,strong) NSArray<NSString *> *sourceLinkArr;

/**
 eg:
    if the lastObject is kind of  UIImageView ,  the `sourceLinkProperyName` is `image`
    if the lastObject is kind of  UIButton ,  the `sourceLinkProperyName` is `currentBackgroundImage` or `currentImage`
 */

/// the property'name of the  sourceLinkArr lastObject
@property (nonatomic,copy  ) NSString *sourceLinkProperyName;

3.How to install

pod 'KNPhotoBrowser'

// terminal : cd ~(current path)
pod install or pod update

5.By the way

  • if you get any idea, just contact me! Thanks

knphotobrowser's People

Contributors

hstdt avatar lukane 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.