Skip to content

Latest commit

 

History

History
91 lines (61 loc) · 2.28 KB

README.md

File metadata and controls

91 lines (61 loc) · 2.28 KB

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.