Just a few lines of code, you can easily add banner to your app.
SDWebImage
//support pod install,just do:
pod 'YPBanner'
//if the repo is not updated,please try:
pod "YPBanner", :git =>"https://github.com/penoty/YPBanner"
YPBannerItem *item_01 = [[YPBannerItem alloc] initWithImage:[UIImage imageNamed:@"placehold.png"] data:nil];
YPBannerItem *item_02 = [[YPBannerItem alloc] initWithUrl:@"web_url"
data:nil
andPlaceholder:[UIImage imageNamed:@"placehold.png"]];
......
_bannerView = [[YPBannerView alloc] initWithYPBannerItems:@[item_01,item_02...]];
_bannerView= [[YPBannerView alloc] initWithYPBannerItems:@[item_01,item_02...]
animationType:YPBannerAnimationTypeCube
andAnimationDuration:1.5f];
//you can setup frame any where you want by using setFrame or masonry
//use setFrame:
[_bannerView setFrame:...];
//use Masonry
[_bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
make...
}];
- (instancetype)initWithFrame:(CGRect)frame
andYPBannerItems:(NSArray<YPBannerItem *> *)itemArray;
- (instancetype)initWithFrame:(CGRect)frame
YPBannerItems:(NSArray<YPBannerItem *> *)itemArray
animationType:(YPBannerAnimationType)type
andAnimationDuration:(NSTimeInterval)duration;
//If you want to have tap callback,just implement the YPBannerViewDelegate method:
- (void)didTapOnBannerItem:(YPBannerItem *)item;
(type:CGFloat)time interval that banner automatically scroll
(type:UIImage *)the banner placeholder image
(type:UIColor)pagecontrol's indicator color
(type:UIColor)pagecontrol's current indicator color
- (void)setPageIndicatorColor:(UIColor *)indicatorColor
andCurrentPageIndicatorColor:(UIColor *)currentIndicatorColor;
- (void)setAnimationType:(YPBannerAnimationType)animationType
andAnimationDuration:(NSTimeInterval)animationDuration;
penoty, penoty@163.com
YPBanner is available under the MIT license. See the LICENSE file for more info.