Skip to content

An easy way to create a swipable set of images with paging indicator

License

Notifications You must be signed in to change notification settings

daront/DTImageScrollView

Repository files navigation

DTImageScrollView

Badge w/ Version License Platform

An easy way to display multiple network images in a standard paging-scrollview style.

Features

  • Display images from specified URLs
  • Custom Placeholder image - while the image is loading
  • Show paging indicator while images are swiped
  • Automatically adjust images to fit the scrollview

System Requirements

iOS 8.0+, Swift 3.0

Installation

CocoaPods

Add into your Podfile.

pod "DTImageScrollView"

Then $ pod install

How to use

Drag a new view to your storyboard or interface builder. Change its class to DTImageScrollView. In viewDidLoad(), set the datasource .

self.imageScrollView.datasource = self

Implement 3 datasource functions

func numberOfImages() -> Int {
    return 3
}

func imageURL(index: Int) -> URL {
    return NSURL(string: "http://www.boxzeed.com/wp-content/uploads/2015/09/1.1.3.jpg")!
}

func placeholderImageFor(index:Int) -> UIImage {
    if index == 0 {
        return UIImage(named: "sample")!
    } else {
        return UIImage(named: "placeholder")!
    }
}

Call show() to reload & display images

self.imageScrollView.show()

See more detail in the demo project

Customizations

You can directly access and modify the scrollview propeties - scrollView pageControl placeholderImage For example,

self.photosScrollView.pageControl.currentPageIndicatorTintColor = Utility.MAIN_RED_COLOR
self.photosScrollView.pageControl.pageIndicatorTintColor = UIColor.whiteColor()

Author

Daron Tancharoen

License

DTImageScrollView is licensed under the MIT License, please see the LICENSE file.

About

An easy way to create a swipable set of images with paging indicator

Resources

License

Stars

Watchers

Forks

Packages

No packages published