-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Leo
committed
Feb 22, 2016
1 parent
0e80d74
commit 79fb346
Showing
5 changed files
with
113 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,16 @@ | |
// Created by Leo on 15/11/30. | ||
// Copyright © 2015年 Leo. All rights reserved. | ||
// | ||
// V 1.0.0 | ||
// GitHub: http://github.com/LeoiOS | ||
// Mail: mailto:[email protected] | ||
// V 1.1.0 | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
|
||
|
||
@class LCBannerView; | ||
|
||
|
||
|
||
@protocol LCBannerViewDelegate <NSObject> | ||
|
||
@optional | ||
|
@@ -27,6 +27,15 @@ | |
|
||
@interface LCBannerView : UIView | ||
|
||
|
||
#pragma mark - Property | ||
|
||
/** | ||
* Page control view bottom distance. Default is `10.0f`. | ||
*/ | ||
@property (nonatomic, assign) CGFloat pageDistance; | ||
|
||
|
||
#pragma mark - Class methods | ||
|
||
/** | ||
|
@@ -72,7 +81,6 @@ currentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor | |
pageIndicatorTintColor:(UIColor *)pageIndicatorTintColor; | ||
|
||
|
||
|
||
#pragma mark - Instance methods | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# LCBannerView | ||
|
||
🔥A very popular and highly customized banner view! And, infinite loop! | ||
🔥A very popular and highly customized banner view! Infinite loop! | ||
|
||
![LCBannerView](https://github.com/LeoiOS/LCBannerView/blob/master/LCBannerViewDemo.gif) | ||
```` | ||
|
@@ -9,6 +9,8 @@ In me the tiger sniffs the rose. | |
心有猛虎,细嗅蔷薇。 | ||
```` | ||
|
||
Welcome to visit my blog: <http://LeoDev.me> ✨ | ||
|
||
[**中文介绍**](https://github.com/LeoiOS/LCBannerView/blob/master/README-zh_CN.md) | ||
|
||
|
||
|
@@ -17,7 +19,7 @@ In me the tiger sniffs the rose. | |
|
||
This is a display of advertising or information. | ||
|
||
You can using the images from **local** or **internet**. | ||
You can using the images from **Local** or **Internet**. | ||
|
||
And it won't affect other scrollViews' `scrollsToTop` propertie. | ||
|
||
|
@@ -43,64 +45,79 @@ Just drag the LCBannerView folder into your project. | |
## Usage | ||
|
||
* Use by including the following import: | ||
````objc | ||
#import "LCBannerView.h" | ||
```` | ||
````objc | ||
#import "LCBannerView.h" | ||
```` | ||
* Demo code: | ||
````objc | ||
// 1. from internet | ||
[scrollView addSubview:({ | ||
|
||
LCBannerView *bannerView = [LCBannerView bannerViewWithFrame:CGRectMake(0, 300.0f, [UIScreen mainScreen].bounds.size.width, 200.0f) | ||
delegate:self | ||
imageURLs:URLs | ||
placeholderImage:nil | ||
timerInterval:2.0f | ||
currentPageIndicatorTintColor:[UIColor redColor] | ||
pageIndicatorTintColor:[UIColor whiteColor]]; | ||
bannerView; | ||
})]; | ||
|
||
// 2. from local | ||
/* | ||
* If you using images from local, you should let images named: `[email protected]`, `[email protected]`... | ||
* Than, you just give me a image named: `banner`. 😜 | ||
*/ | ||
[scrollView addSubview:({ | ||
|
||
LCBannerView *bannerView = [[LCBannerView alloc] initWithFrame:CGRectMake(0, 20.0f, [UIScreen mainScreen].bounds.size.width, 200.0f) | ||
````objc | ||
// 1. from internet | ||
[scrollView addSubview:({ | ||
|
||
LCBannerView *bannerView = [LCBannerView bannerViewWithFrame:CGRectMake(0, 300.0f, [UIScreen mainScreen].bounds.size.width, 200.0f) | ||
delegate:self | ||
imageName:@"banner" | ||
count:3 | ||
timerInterval:3.0f | ||
currentPageIndicatorTintColor:[UIColor orangeColor] | ||
imageURLs:URLs | ||
placeholderImage:nil | ||
timerInterval:2.0f | ||
currentPageIndicatorTintColor:[UIColor redColor] | ||
pageIndicatorTintColor:[UIColor whiteColor]]; | ||
bannerView; | ||
})]; | ||
|
||
```` | ||
bannerView.pageDistance = 20.0f; | ||
bannerView; | ||
})]; | ||
|
||
// 2. from local | ||
/* | ||
* If you using images from local, you should let images named: `[email protected]`, `[email protected]`... | ||
* Than, you just give me a image named: `banner`. 😜 | ||
*/ | ||
[scrollView addSubview:({ | ||
|
||
LCBannerView *bannerView = [[LCBannerView alloc] initWithFrame:CGRectMake(0, 20.0f, [UIScreen mainScreen].bounds.size.width, 200.0f) | ||
delegate:self | ||
imageName:@"banner" | ||
count:3 | ||
timerInterval:3.0f | ||
currentPageIndicatorTintColor:[UIColor orangeColor] | ||
pageIndicatorTintColor:[UIColor whiteColor]]; | ||
bannerView; | ||
})]; | ||
|
||
```` | ||
* Delegate (`@optional`): | ||
````objc | ||
- (void)bannerView:(LCBannerView *)bannerView didClickedImageIndex:(NSInteger)index; | ||
```` | ||
* For example: | ||
````objc | ||
- (void)bannerView:(LCBannerView *)bannerView didClickedImageIndex:(NSInteger)index { | ||
NSLog(@"you clicked image in %@ at index: %ld", bannerView, (long)index); | ||
} | ||
|
||
// logs | ||
2015-11-30 17:36:20.611 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b751ff0; frame = (0 300; 375 200); layer = <CALayer: 0x7fc98b7521b0>> at index: 1 | ||
2015-11-30 17:36:21.292 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b433190; frame = (0 20; 375 200); layer = <CALayer: 0x7fc98b42ce20>> at index: 1 | ||
2015-11-30 17:36:21.801 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b751ff0; frame = (0 300; 375 200); layer = <CALayer: 0x7fc98b7521b0>> at index: 2 | ||
```` | ||
````objc | ||
- (void)bannerView:(LCBannerView *)bannerView didClickedImageIndex:(NSInteger)index; | ||
```` | ||
* For example: | ||
````objc | ||
- (void)bannerView:(LCBannerView *)bannerView didClickedImageIndex:(NSInteger)index { | ||
|
||
NSLog(@"you clicked image in %@ at index: %ld", bannerView, (long)index); | ||
} | ||
|
||
// logs | ||
2015-11-30 17:36:20.611 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b751ff0; frame = (0 300; 375 200); layer = <CALayer: 0x7fc98b7521b0>> at index: 1 | ||
2015-11-30 17:36:21.292 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b433190; frame = (0 20; 375 200); layer = <CALayer: 0x7fc98b42ce20>> at index: 1 | ||
2015-11-30 17:36:21.801 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b751ff0; frame = (0 300; 375 200); layer = <CALayer: 0x7fc98b7521b0>> at index: 2 | ||
```` | ||
* Custom parameters (in `LCBannerView.m`): | ||
````objc | ||
// pageControl to the bottom of the distance | ||
static CGFloat LCPageDistance = 10.0f; | ||
```` | ||
````objc | ||
// pageControl to the bottom of the distance | ||
static CGFloat LCPageDistance = 10.0f; | ||
```` | ||
|
||
|
||
|
||
## Release | ||
|
||
### V 1.1.0 | ||
* You could custom page control bottom distance now. For example: | ||
````objc | ||
// ... | ||
bannerView.pageDistance = 20.0f; | ||
```` | ||
|
||
### V 1.0.0 | ||
* Initial commit. | ||
|
||
|
||
|
||
|
@@ -111,8 +128,8 @@ static CGFloat LCPageDistance = 10.0f; | |
|
||
## Support | ||
* If you have any questions, please commit a issure! Thx! | ||
* Email: [email protected] & liucsuper@gmail.com | ||
* Blog: http://LeoDev.me & http://www.leodong.com | ||
* Email: devtip@163.com | ||
* Blog: http://LeoDev.me | ||
|
||
|
||
|
||
|