Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a bit more flexibility in skinning #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion EGOTableViewPullRefresh/Classes/View/EGORefreshTableHeaderView.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ typedef enum{

@property(nonatomic,assign) id <EGORefreshTableHeaderDelegate> delegate;

- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor;
+ (NSString *)defaultArrowImageName;
+ (UIColor *)defaultTextColor;
+ (UIColor *)defaultShadowColor;
+ (UIColor *)defaultBackgroundColor;

- (id)initWithFrame:(CGRect)frame
arrowImageName:(NSString *)arrow
textColor:(UIColor *)textColor
shadowColor:(UIColor *)shadowColor
backgroundColor:(UIColor *)backgroundColor;

- (void)refreshLastUpdatedDate;
- (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView;
Expand Down
42 changes: 35 additions & 7 deletions EGOTableViewPullRefresh/Classes/View/EGORefreshTableHeaderView.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#import "EGORefreshTableHeaderView.h"


#define TEXT_COLOR [UIColor colorWithRed:87.0/255.0 green:108.0/255.0 blue:137.0/255.0 alpha:1.0]
#define FLIP_ANIMATION_DURATION 0.18f


Expand All @@ -39,18 +38,23 @@ @implementation EGORefreshTableHeaderView

@synthesize delegate=_delegate;


- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor {
- (id)initWithFrame:(CGRect)frame
arrowImageName:(NSString *)arrow
textColor:(UIColor *)textColor
shadowColor:(UIColor *)shadowColor
backgroundColor:(UIColor *)backgroundColor {
if (self = [super initWithFrame:frame]) {

self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.backgroundColor = [UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:1.0];
self.backgroundColor = backgroundColor;

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, frame.size.height - 30.0f, self.frame.size.width, 20.0f)];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
label.font = [UIFont systemFontOfSize:12.0f];
label.textColor = textColor;
label.shadowColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
if(shadowColor != nil) {
label.shadowColor = shadowColor;
}
label.shadowOffset = CGSizeMake(0.0f, 1.0f);
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
Expand All @@ -62,7 +66,9 @@ - (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UI
label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
label.font = [UIFont boldSystemFontOfSize:13.0f];
label.textColor = textColor;
label.shadowColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
if(shadowColor != nil) {
label.shadowColor = shadowColor;
}
label.shadowOffset = CGSizeMake(0.0f, 1.0f);
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
Expand Down Expand Up @@ -100,7 +106,29 @@ - (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UI
}

- (id)initWithFrame:(CGRect)frame {
return [self initWithFrame:frame arrowImageName:@"blueArrow.png" textColor:TEXT_COLOR];
return [self initWithFrame:frame
arrowImageName:[EGORefreshTableHeaderView defaultArrowImageName]
textColor:[EGORefreshTableHeaderView defaultTextColor]
shadowColor:[EGORefreshTableHeaderView defaultShadowColor]
backgroundColor:[EGORefreshTableHeaderView defaultBackgroundColor]];
}

#pragma mark - Getters

+ (NSString *)defaultArrowImageName {
return @"blueArrow.png";
}

+ (UIColor *)defaultTextColor {
return [UIColor colorWithRed:87.0/255.0 green:108.0/255.0 blue:137.0/255.0 alpha:1.0];
}

+ (UIColor *)defaultShadowColor {
return [UIColor colorWithWhite:0.9f alpha:1.0f];
}

+ (UIColor *)defaultBackgroundColor {
return [UIColor colorWithRed:87.0/255.0 green:108.0/255.0 blue:137.0/255.0 alpha:1.0];
}

#pragma mark -
Expand Down