diff --git a/.gitignore b/.gitignore index 6edbbeb..edc082c 100644 --- a/.gitignore +++ b/.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 diff --git a/Classes/DemoTableViewController.m b/Classes/DemoTableViewController.m index 2522d67..bf9f1f9 100644 --- a/Classes/DemoTableViewController.m +++ b/Classes/DemoTableViewController.m @@ -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) { diff --git a/Classes/PullRefreshTableViewController.h b/Classes/PullRefreshTableViewController.h index 00450a2..92429f3 100644 --- a/Classes/PullRefreshTableViewController.h +++ b/Classes/PullRefreshTableViewController.h @@ -50,6 +50,7 @@ @property (nonatomic, copy) NSString *textRelease; @property (nonatomic, copy) NSString *textLoading; +- (void)setupStrings; - (void)addPullToRefreshHeader; - (void)startLoading; - (void)stopLoading; diff --git a/Classes/PullRefreshTableViewController.m b/Classes/PullRefreshTableViewController.m index b373376..85de5b9 100644 --- a/Classes/PullRefreshTableViewController.m +++ b/Classes/PullRefreshTableViewController.m @@ -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 { @@ -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]; diff --git a/main.m b/main.m index 788b3cd..76d791e 100644 --- a/main.m +++ b/main.m @@ -9,7 +9,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, @"PullToRefreshAppDelegate"); [pool release];