Skip to content

Commit

Permalink
添加停止菊花颜色的控制属性
Browse files Browse the repository at this point in the history
  • Loading branch information
xhzengAIB committed Sep 16, 2015
1 parent 7ba97c2 commit 3175860
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ @implementation XHPinterestPullRefreshTableViewController
- (XHPinterestRefreshView *)refreshView {
if (!_refreshView) {
_refreshView = [[XHPinterestRefreshView alloc] initWithFrame:CGRectMake(0, -50, CGRectGetWidth(self.view.bounds), 50)];
_refreshView.activityIndicatorColor = self.indicatorColor;
}
return _refreshView;
}
Expand Down
1 change: 1 addition & 0 deletions RefreshControl/Manager/XHRefreshControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ - (void)setCircleLineWidth:(CGFloat)circleLineWidth {
- (void)setIndicatorColor:(UIColor *)indicatorColor {
_indicatorColor = indicatorColor;
self.refreshActivityIndicatorContainerView.activityIndicatorView.tintColor = indicatorColor;
self.loadMoreView.activityIndicatorColor = indicatorColor;
}

#pragma mark - Getter Method
Expand Down
2 changes: 2 additions & 0 deletions RefreshControl/Views/XHLoadMoreView.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
@property (nonatomic, strong) UIButton *loadMoreButton;

@property (nonatomic, strong) UIColor *activityIndicatorColor;

/**
* 当外部需要自定义加载更多的按钮时,需要通过该方法进行覆盖原本的按钮
*
Expand Down
15 changes: 12 additions & 3 deletions RefreshControl/Views/XHLoadMoreView.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@

#import "XHLoadMoreView.h"

#import "XHActivityIndicatorView.h"

@interface XHLoadMoreView ()

/**
* 系统默认菊花控件
*/
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicatorView;
@property (nonatomic, strong) XHActivityIndicatorView *activityIndicatorView;

/**
* 外部定制的提示视图,只有在没有数据的情况下才会出现的
Expand Down Expand Up @@ -99,9 +101,16 @@ - (UIButton *)loadMoreButton {
return _loadMoreButton;
}

- (UIActivityIndicatorView *)activityIndicatorView {
- (void)setActivityIndicatorColor:(UIColor *)activityIndicatorColor {
_activityIndicatorColor = activityIndicatorColor;
self.activityIndicatorView.color = activityIndicatorColor;
}

- (XHActivityIndicatorView *)activityIndicatorView {
if (!_activityIndicatorView) {
_activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
_activityIndicatorView = [[XHActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
_activityIndicatorView.color = [UIColor colorWithRed:228/255.0 green:27 / 255.0 blue:70/255.0 alpha:1.000];
_activityIndicatorView.indicatorRadius = 6;
_activityIndicatorView.hidesWhenStopped = YES;
_activityIndicatorView.center = CGPointMake(CGRectGetWidth(self.bounds) / 2.85, CGRectGetHeight(self.bounds) / 2.0);
}
Expand Down
7 changes: 7 additions & 0 deletions RefreshControl/Views/XHPinterestRefreshView.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@

@interface XHPinterestRefreshView : UIView

@property (nonatomic, strong) UIColor *activityIndicatorColor;

@property (nonatomic, assign) CGFloat pullDownOffset;

- (instancetype)initWithFrame:(CGRect)frame
logoImageName:(NSString *)logoImageName
backCircleImageName:(NSString *)backCircleImageName
frontCircleImage:(NSString *)frontCircleImage;

- (void)willStartRefreshing;
- (void)didStartRefreshing;

Expand Down
26 changes: 23 additions & 3 deletions RefreshControl/Views/XHPinterestRefreshView.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,28 @@ @interface XHPinterestRefreshView ()
@property (nonatomic, strong) XHActivityIndicatorView *activityIndicatorView;
@property (nonatomic, strong) XHCircularProgressView *circularProgressView;

@property (nonatomic, copy) NSString *logoImageName;
@property (nonatomic, copy) NSString *backCircleImageName;
@property (nonatomic, copy) NSString *frontCircleImage;

@end

@implementation XHPinterestRefreshView

- (instancetype)initWithFrame:(CGRect)frame {
return [self initWithFrame:frame logoImageName:@"bicon" backCircleImageName:@"light_circle" frontCircleImage:@"dark_circle"];
}

- (instancetype)initWithFrame:(CGRect)frame
logoImageName:(NSString *)logoImageName
backCircleImageName:(NSString *)backCircleImageName
frontCircleImage:(NSString *)frontCircleImage {
self = [super initWithFrame:frame];
if (self) {
self.logoImageName = logoImageName;
self.backCircleImageName = backCircleImageName;
self.frontCircleImage = frontCircleImage;

[self addSubview:self.activityIndicatorView];
[self addSubview:self.circularProgressView];
}
Expand Down Expand Up @@ -68,6 +83,11 @@ - (void)setPullDownOffset:(CGFloat)pullDownOffset {
self.circularProgressView.progress = progress;
}

- (void)setActivityIndicatorColor:(UIColor *)activityIndicatorColor {
_activityIndicatorColor = activityIndicatorColor;
self.activityIndicatorView.color = activityIndicatorColor;
}

- (XHActivityIndicatorView *)activityIndicatorView {
if (!_activityIndicatorView) {
_activityIndicatorView = [[XHActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
Expand All @@ -80,9 +100,9 @@ - (XHActivityIndicatorView *)activityIndicatorView {

- (XHCircularProgressView *)circularProgressView {
if (!_circularProgressView) {
UIImage *logoImage = [UIImage imageNamed:@"bicon.png"];
UIImage *backCircleImage = [UIImage imageNamed:@"light_circle.png"];
UIImage *frontCircleImage = [UIImage imageNamed:@"dark_circle.png"];
UIImage *logoImage = [UIImage imageNamed:self.logoImageName];
UIImage *backCircleImage = [UIImage imageNamed:self.backCircleImageName];
UIImage *frontCircleImage = [UIImage imageNamed:self.frontCircleImage];

_circularProgressView = [[XHCircularProgressView alloc] initWithFrame:CGRectMake(0, 0, 25, 25)
logo:logoImage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ - (instancetype)init {
self = [super init];
if (self) {
//self.pullDownRefreshed = NO;
self.indicatorColor = [UIColor greenColor];
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile~ipad</key>
<string>Main_iPad</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down

0 comments on commit 3175860

Please sign in to comment.