Skip to content

A simple image browser. Supports UIImage, URL, and GIF.

License

Notifications You must be signed in to change notification settings

voya-ai/TWImageBrowser

 
 

Repository files navigation

TWImageBrowser

Version License Platform Support Language

A simple image browser. Add UIImage, URL, GIF type.

Demo

Demo

Demo

Usage

let viewer = TWImageBrowser(frame: self.view.bounds)
viewer.viewPadding = 10.0
viewer.browserType = .normal    // or .banner
viewer.delegate = self
viewer.dataSource = self
viewer.backgroundColor = UIColor.black
self.automaticallyAdjustsScrollViewInsets = false   // precondition
view.addSubview(viewer)

DataSource

func backgroundImage(_ imageBrowser : TWImageBrowser) -> UIImage? {
    return nil
}

func loadObjects(_ imageBrowser : TWImageBrowser) -> [Any]? {
    let imageList: [Any] = []
    imageList.append("image0.jpg")
    imageList.append("image1.jpg")

    return imageList
}

Delegate

func imageBrowserDidScroll(_ imageBrowser : TWImageBrowser) {

}

func imageBrowserDidEndScrollingAnimation(_ imageBrowser : TWImageBrowser) {

}

func imageBrowserDidSingleTap(_ imageBrowser: TWImageBrowser, page: Int) {

}

func imageBrowserDidDoubleTap(_ imageBrowser: TWImageBrowser, page: Int, currentZoomScale: CGFloat) {

}

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

TWImageBrowser is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TWImageBrowser'

If you are using swift2.x version, install it below.

pod 'TWImageBrowser', :branch => 'swift2.3'

Author

magicmon, http://magicmon.tistory.com

License

TWImageBrowser is available under the MIT license. See the LICENSE file for more info.

About

A simple image browser. Supports UIImage, URL, and GIF.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 97.7%
  • Ruby 2.3%