Skip to content
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
13 changes: 10 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Classes/DemoTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
Expand Down
1 change: 1 addition & 0 deletions Classes/PullRefreshTableViewController.h
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion main.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"PullToRefreshAppDelegate");
[pool release];
Expand Down