Latest 1.0.2
Homepage https://github.com/penoty/YPBanner
License MIT
Platforms ios 7.0, requires ARC
Dependencies SDWebImage
Authors

Just a few lines of code, you can easily add banner to your app.

![image](https://github.com/penoty/YPBanner/blob/master/banner_gif1.gif )
![image](https://github.com/penoty/YPBanner/blob/master/banner_gif2.gif )

Dependency

SDWebImage

How to install?

    //support pod install,just do:
    pod 'YPBanner' 
    //if the repo is not updated,please try:
    pod "YPBanner", :git =>"https://github.com/penoty/YPBanner"

How to use?(need import "YPBannerView.h")

Banner Item Init

    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"]];
    ......

Default Animation

    _bannerView = [[YPBannerView alloc] initWithYPBannerItems:@[item_01,item_02...]];     

Set animation type and duration

    _bannerView= [[YPBannerView alloc] initWithYPBannerItems:@[item_01,item_02...] 
                                               animationType:YPBannerAnimationTypeCube 
                                        andAnimationDuration:1.5f];

Setup Frame

    //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...
     }];

Setup frame when init

    - (instancetype)initWithFrame:(CGRect)frame
                 andYPBannerItems:(NSArray<YPBannerItem *> *)itemArray;
    - (instancetype)initWithFrame:(CGRect)frame
                    YPBannerItems:(NSArray<YPBannerItem *> *)itemArray      
                    animationType:(YPBannerAnimationType)type
             andAnimationDuration:(NSTimeInterval)duration;

YPBannerViewDelegate

    //If you want to have tap callback,just implement the YPBannerViewDelegate method:
    - (void)didTapOnBannerItem:(YPBannerItem *)item;

Public Properties

scrollTimeInterval
    (type:CGFloat)time interval that banner automatically scroll
placeholderImg
    (type:UIImage *)the banner placeholder image 
pageIndicatorTintColor
    (type:UIColor)pagecontrol's indicator color
currentPageIndicatorColor
    (type:UIColor)pagecontrol's current indicator color
using the method to setup the pagecontrol
    - (void)setPageIndicatorColor:(UIColor *)indicatorColor 
     andCurrentPageIndicatorColor:(UIColor *)currentIndicatorColor;
using the method to setup animation type and duration
    - (void)setAnimationType:(YPBannerAnimationType)animationType
     andAnimationDuration:(NSTimeInterval)animationDuration;

Author

penoty, [email protected]

License

YPBanner is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "YPBanner",
    "version": "1.0.2",
    "summary": "YPBanner,simple usage,esily add banner to your project.",
    "description": "Just a few lines of codes, you can easily add a banner to your project.",
    "homepage": "https://github.com/penoty/YPBanner",
    "license": "MIT",
    "authors": {
        "penoty": "[email protected]"
    },
    "source": {
        "git": "https://github.com/penoty/YPBanner.git",
        "tag": "1.0.2"
    },
    "social_media_url": "http://twitter.com/PenotyYu",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/YPBanner/*",
    "public_header_files": "Pod/Classes/YPBanner/*.h",
    "dependencies": {
        "SDWebImage": [
            "~> 3.8.1"
        ]
    }
}

Pin It on Pinterest

Share This