A ViewPager that can scroll automatically.
- iOS 7.0 or later
- Xcode 7.3 or later
- 在
Podfile
中添加pod 'DJBannerView'
。
pod 'DJBannerView'
- 执行
pod install
或pod update
。
$ pod install
- 导入
<DJBannerView/DJBannerView.h>
。
#import <DJBannerView/DJBannerView.h>
#import <DJBannerView/DJPageBannerView.h>
#import <DJBannerView/DJManualBannerView.h>
All source code is licensed under the MIT License.
DJBannerView
DJPageBannerView
DJManualBannerView
BannerViewScrollDirectionLandscape /** 水平滚动 **/
BannerViewScrollDirectionPortait /** 垂直滚动 **/
BannerViewPageStyle_None
/** 不显示 **/BannerViewPageStyle_Left
/** 居左 **/BannerViewPageStyle_Middle
/** 居中 **/BannerViewPageStyle_Right
/** 居右 **/
self.bannerView = [[DJBannerView alloc] initWithFrame:CGRectMake(0, 50.0f, UI_SCREEN_WIDTH, UI_SCREEN_WIDTH*140/320) scrollDirection:BannerViewScrollDirectionPortait images:dataArray];
[self.bannerView setRollingDelayTime:4.0f];
[self.bannerView setDelegate:self];
[self.bannerView setPageControlStyle:BannerViewPageStyle_Right];
[self.view addSubview:self.bannerView];
[self.bannerView startRolling];
DJPageBannerView *pageBannerView = [[DJPageBannerView alloc] initWithFrame:CGRectMake(0, bannerView.frame.origin.y+bannerView.frame.size.height+20.0f, UI_SCREEN_WIDTH, (UI_SCREEN_WIDTH-80.0f)*140/320) scrollDirection:BannerViewScrollDirectionLandscape images:dataArray pageWidth:UI_SCREEN_WIDTH-80.0f padding:10.0f];
[pageBannerView setDelegate:self];
[pageBannerView setPageControlStyle:BannerViewPageStyle_Middle];
pageBannerView.showClose = NO;
[pageBannerView setCorner:8.0f];
[self.view addSubview:pageBannerView];
self.manualBannerView = [[DJManualBannerView alloc] initWithFrame:CGRectMake(0.0f, pageBannerView.frame.origin.y+pageBannerView.frame.size.height+20.0f, UI_SCREEN_WIDTH, Image_Height) scrollDirection:BannerViewScrollDirectionLandscape images:nil padding:20.0f pageWidth:Image_Width dataSource:self];
self.manualBannerView.hasLeftPadding = YES;
[self.manualBannerView setPageControlStyle:BannerViewPageStyle_None];
[self.manualBannerView reloadBannerWithData:nil];
[self.manualBannerView setCorner:6.0f];
[self.view addSubview:self.manualBannerView];