Simple Banner View that automatically scrolls.
| English localization | Arabic localization |
|---|---|
![]() | ![]() |
- iOS 8.0+
- Xcode 8.0+
- Swift 3.0+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsCocoaPods 1.1.0+ is required to build Reusable 1.0.0+.
To integrate BannerView into your Xcode project using CocoaPods, specify it in your Podfile:
source'https://github.com/CocoaPods/Specs.git'platform:ios,'8.0'use_frameworks!target'<Your Target Name>'dopod'MLBannerView'endThen, run the following command:
$ pod installTo add BannerView you may set class to view as BannerView in storyboard or create it manually from code.
bannerView.setup(
type:BannerViewScrollType.fromStart,
timeForOneItem:1,
bannerItems:[BannerItem(image:UIImage(named:"banner_1")),BannerItem(image:UIImage(named:"banner_2")),BannerItem(image:UIImage(named:"banner_3"))],
delegate:self)BannerViewDelegate allows you to be notifed when banner scrolls to next item or when user clicks on item.
/**
BannerViewDelegate.
*/
@objcpublicprotocolBannerViewDelegate{
/**
Notifies when banner view scrolls to the next item.
*/
@objcoptionalfunc bannerView(bannerView:BannerView, didScrollTo:BannerItem, with index:Int)
/**
Notifies when user selects item.
*/
@objcoptionalfunc bannerView(bannerView:BannerView, didSelectItem:BannerItem, with index:Int)
/**
Allows to use custom cell.
*/
@objcoptionalfunc bannerView(bannerView:BannerView, collectionView:UICollectionView,
cellForItemAt indexPath:IndexPath)->UICollectionViewCell?}/**
BannerViewScrollType contains different scroll types.
*/
publicenumBannerViewScrollType{
/**
BannerView scrolls to the start after the last item.
*/
case fromStart
/**
BannerView scrolls to the end item and then to the first item through all items.
*/
case reverse
/**
BannerView always scrolls forward.
*/
case alwaysForward
}| .fromStart | .reverse | .alwaysForward |
|---|---|---|
![]() | ![]() | ![]() |
You may access bannerPageControl through public property
bannerView.pageControl.color =UIColor.black
bannerView.pageControl.currentPageColor =UIColor.greenBannerView is released under the MIT license. See LICENSE for details.




