EGOStyle #26

Open
wants to merge 10 commits into
from

Projects

None yet

1 participant

@typeoneerror

I refactored the initializers and added the idea of having EGOStyle define a set of predefined styles. EGOStyleBlack for example initializes a PullRefresh with a black background, white arrow, and white text:

typedef enum {
    EGOStyleBlue,
    EGOStyleBlack,
    EGOStyleWhite,
    EGOStyleGrey,
} EGOStyle;

Also added some initializers that create the frame based on a table and view.

EGORefreshTableHeaderView *refreshView = [[EGORefreshTableHeaderView alloc] initWithView:self.view
                                                                               tableView:self.tableView
                                                                                   style:EGOStyleBlack];

Added an "objectKey" property that allows you to save different instances of the date to NSUserDefaults.

refreshView.objectKey = @"keyForThisInstance"

Finally, I exposed the properties publicly so those can be modified more readily:

@implementation RefreshTableHeaderView

- (id)initWithView:(UIView *)view tableView:(UITableView *)tableView style:(EGOStyle)style
{
  self = [super initWithView:view tableView:tableView style:style];
  if (self)
  {
      self.backgroundColor = [UIColor colorWithWhite:0.1f alpha:1.0f];
      self.statusLabel.textColor = [UIColor redColor];
      self.statusLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.75f];
      self.statusLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
      self.lastUpdatedLabel.textColor = [UIColor redColor];
      self.lastUpdatedLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.75f];
      self.lastUpdatedLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
  }
  return self;
}

@end

Also cleaned up formatting (tabs -> spaces, et al). Let me know if anything is broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment