Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo committed Feb 22, 2016
1 parent 0e80d74 commit 79fb346
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 77 deletions.
10 changes: 5 additions & 5 deletions LCBannerView.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |s|

s.name = "LCBannerView"
s.version = "1.0.0"
s.summary = "A very popular and highly customized banner view! . Support: http://www.leodong.com"
s.version = "1.1.0"
s.summary = "A very popular and highly customized banner view! Infinite loop! Support: http://LeoDev.me"
s.homepage = "https://github.com/LeoiOS/LCBannerView"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Leo" => "leoios@sina.com" }
s.social_media_url = "http://www.leodong.com"
s.author = { "Leo" => "devtip@163.com" }
s.social_media_url = "http://LeoDev.me"
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/LeoiOS/LCBannerView.git", :tag => s.version }
s.source_files = "LCBannerView/*"
s.source_files = "LCBannerView/*"
s.requires_arc = true

s.dependency "SDWebImage"
Expand Down
16 changes: 12 additions & 4 deletions LCBannerView/LCBannerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:devtip@163.com
// V 1.1.0

#import <UIKit/UIKit.h>



@class LCBannerView;



@protocol LCBannerViewDelegate <NSObject>

@optional
Expand All @@ -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

/**
Expand Down Expand Up @@ -72,7 +81,6 @@ currentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor
pageIndicatorTintColor:(UIColor *)pageIndicatorTintColor;



#pragma mark - Instance methods

/**
Expand Down
34 changes: 22 additions & 12 deletions LCBannerView/LCBannerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Leo on 15/11/30.
// Copyright © 2015年 Leo. All rights reserved.
//
// V 1.0.0
//

#import "LCBannerView.h"
#import "UIImageView+WebCache.h"
Expand All @@ -14,19 +14,19 @@

@interface LCBannerView () <UIScrollViewDelegate>

@property (nonatomic, weak) id<LCBannerViewDelegate> delegate;
@property (nonatomic, weak ) id<LCBannerViewDelegate> delegate;

@property (nonatomic, copy) NSString *imageName;
@property (nonatomic, strong) NSArray *imageURLs;
@property (nonatomic, assign) NSInteger count;
@property (nonatomic, assign) CGFloat timerInterval;
@property (nonatomic, strong) UIColor *currentPageIndicatorTintColor;
@property (nonatomic, strong) UIColor *pageIndicatorTintColor;
@property (nonatomic, copy) NSString *placeholderImage;
@property (nonatomic, copy ) NSString *imageName;
@property (nonatomic, strong) NSArray *imageURLs;
@property (nonatomic, assign) NSInteger count;
@property (nonatomic, assign) CGFloat timerInterval;
@property (nonatomic, strong) UIColor *currentPageIndicatorTintColor;
@property (nonatomic, strong) UIColor *pageIndicatorTintColor;
@property (nonatomic, copy ) NSString *placeholderImage;

@property (nonatomic, strong) NSTimer *timer;
@property (nonatomic, weak) UIScrollView *scrollView;
@property (nonatomic, weak) UIPageControl *pageControl;
@property (nonatomic, strong) NSTimer *timer;
@property (nonatomic, weak ) UIScrollView *scrollView;
@property (nonatomic, weak ) UIPageControl *pageControl;

@end

Expand Down Expand Up @@ -183,6 +183,16 @@ - (void)imageViewTaped:(UITapGestureRecognizer *)tap {
}
}

- (void)setPageDistance:(CGFloat)pageDistance {
_pageDistance = pageDistance;

if (pageDistance != LCPageDistance) {
CGRect frame = self.pageControl.frame;
frame.origin.y = self.frame.size.height - 10.0f - pageDistance;
self.pageControl.frame = frame;
}
}

#pragma mark - Timer

- (void)addTimer {
Expand Down
1 change: 1 addition & 0 deletions LCBannerViewDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ - (void)viewDidLoad {
timerInterval:3.0f
currentPageIndicatorTintColor:[UIColor orangeColor]
pageIndicatorTintColor:[UIColor whiteColor]];
bannerView.pageDistance = 20.0f;
bannerView;
})];

Expand Down
129 changes: 73 additions & 56 deletions README.md
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)
````
Expand All @@ -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)


Expand All @@ -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.

Expand All @@ -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: `banner_01@2x.png`, `banner_02@2x.png`...
* 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: `banner_01@2x.png`, `banner_02@2x.png`...
* 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.



Expand All @@ -111,8 +128,8 @@ static CGFloat LCPageDistance = 10.0f;

## Support
* If you have any questions, please commit a issure! Thx!
* Email: leoios@sina.com & liucsuper@gmail.com
* Blog: http://LeoDev.me & http://www.leodong.com
* Email: devtip@163.com
* Blog: http://LeoDev.me



Expand Down

0 comments on commit 79fb346

Please sign in to comment.