A simple image browser. Add UIImage, URL, GIF type.
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) {
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
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'
magicmon, http://magicmon.tistory.com
TWImageBrowser is available under the MIT license. See the LICENSE file for more info.