Skip to content

Commit

Permalink
Merge pull request leah#9 from maddox/master
Browse files Browse the repository at this point in the history
added a couple things
  • Loading branch information
leah committed Aug 2, 2011
2 parents 266caa5 + d5a7feb commit 6ae5ed9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
13 changes: 10 additions & 3 deletions .gitignore
@@ -1,8 +1,15 @@
# xcode
# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
# osx
.DS_Store
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
1 change: 1 addition & 0 deletions Classes/PullRefreshTableViewController.h
Expand Up @@ -50,6 +50,7 @@
@property (nonatomic, copy) NSString *textRelease;
@property (nonatomic, copy) NSString *textLoading;

- (void)setupStrings;
- (void)addPullToRefreshHeader;
- (void)startLoading;
- (void)stopLoading;
Expand Down
44 changes: 32 additions & 12 deletions Classes/PullRefreshTableViewController.m
Expand Up @@ -38,18 +38,38 @@ @implementation PullRefreshTableViewController
@synthesize textPull, textRelease, textLoading, refreshHeaderView, refreshLabel, refreshArrow, refreshSpinner;

- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:style];
if (self != nil) {
textPull = [[NSString alloc] initWithString:@"Pull down to refresh..."];
textRelease = [[NSString alloc] initWithString:@"Release to refresh..."];
textLoading = [[NSString alloc] initWithString:@"Loading..."];
}
return self;
self = [super initWithStyle:style];
if (self != nil) {
[self setupStrings];
}
return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self != nil) {
[self setupStrings];
}
return self;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self != nil) {
[self setupStrings];
}
return self;
}

- (void)viewDidLoad {
[super viewDidLoad];
[self addPullToRefreshHeader];
[super viewDidLoad];
[self addPullToRefreshHeader];
}

- (void)setupStrings{
textPull = [[NSString alloc] initWithString:@"Pull down to refresh..."];
textRelease = [[NSString alloc] initWithString:@"Release to refresh..."];
textLoading = [[NSString alloc] initWithString:@"Loading..."];
}

- (void)addPullToRefreshHeader {
Expand All @@ -62,12 +82,12 @@ - (void)addPullToRefreshHeader {
refreshLabel.textAlignment = UITextAlignmentCenter;

refreshArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow.png"]];
refreshArrow.frame = CGRectMake((REFRESH_HEADER_HEIGHT - 27) / 2,
(REFRESH_HEADER_HEIGHT - 44) / 2,
refreshArrow.frame = CGRectMake(floorf((REFRESH_HEADER_HEIGHT - 27) / 2),
(floorf(REFRESH_HEADER_HEIGHT - 44) / 2),
27, 44);

refreshSpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
refreshSpinner.frame = CGRectMake((REFRESH_HEADER_HEIGHT - 20) / 2, (REFRESH_HEADER_HEIGHT - 20) / 2, 20, 20);
refreshSpinner.frame = CGRectMake(floorf(floorf(REFRESH_HEADER_HEIGHT - 20) / 2), floorf((REFRESH_HEADER_HEIGHT - 20) / 2), 20, 20);
refreshSpinner.hidesWhenStopped = YES;

[refreshHeaderView addSubview:refreshLabel];
Expand Down

0 comments on commit 6ae5ed9

Please sign in to comment.