Permalink
Browse files

Added new init method that accepts a background color

  • Loading branch information...
1 parent 743679f commit f5252db0ba3f75f63d2e7404d40492fbbe1ba05a @netdev committed Dec 1, 2011
@@ -50,6 +50,7 @@ typedef enum{
@property(nonatomic,assign) id <EGORefreshTableHeaderDelegate> delegate;
- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor;
+- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor backgroundColor:(UIColor *)backgroundColor;
- (void)refreshLastUpdatedDate;
- (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView;
@@ -28,6 +28,7 @@
#define TEXT_COLOR [UIColor colorWithRed:87.0/255.0 green:108.0/255.0 blue:137.0/255.0 alpha:1.0]
+#define BACKGROUND_COLOR [UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:1.0]
#define FLIP_ANIMATION_DURATION 0.18f
@@ -39,12 +40,11 @@ @implementation EGORefreshTableHeaderView
@synthesize delegate=_delegate;
-
-- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor {
- if((self = [super initWithFrame:frame])) {
+- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor 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;
@@ -96,11 +96,14 @@ - (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UI
}
return self;
-
+}
+
+- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor {
+ return [self initWithFrame:frame arrowImageName:arrow textColor:textColor backgroundColor:BACKGROUND_COLOR];
}
- (id)initWithFrame:(CGRect)frame {
- return [self initWithFrame:frame arrowImageName:@"blueArrow.png" textColor:TEXT_COLOR];
+ return [self initWithFrame:frame arrowImageName:@"blueArrow.png" textColor:TEXT_COLOR];
}
#pragma mark -

0 comments on commit f5252db

Please sign in to comment.