Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the arrow position configurable by a property #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions Classes/PullRefreshTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
@property (nonatomic, copy) NSString *textPull;
@property (nonatomic, copy) NSString *textRelease;
@property (nonatomic, copy) NSString *textLoading;
@property (nonatomic) CGFloat arrowLeftPadding;

- (void)setupStrings;
- (void)addPullToRefreshHeader;
Expand Down
15 changes: 12 additions & 3 deletions Classes/PullRefreshTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@

@implementation PullRefreshTableViewController

@synthesize textPull, textRelease, textLoading, refreshHeaderView, refreshLabel, refreshArrow, refreshSpinner;
@synthesize textPull, textRelease, textLoading, refreshHeaderView, refreshLabel, refreshArrow, refreshSpinner, arrowLeftPadding;

- (void) defaults {
arrowLeftPadding = 0;
}

- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:style];
if (self != nil) {
[self defaults];
[self setupStrings];
}
return self;
Expand All @@ -48,6 +53,7 @@ - (id)initWithStyle:(UITableViewStyle)style {
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self != nil) {
[self defaults];
[self setupStrings];
}
return self;
Expand All @@ -56,6 +62,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder {
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self != nil) {
[self defaults];
[self setupStrings];
}
return self;
Expand All @@ -82,12 +89,14 @@ - (void)addPullToRefreshHeader {
refreshLabel.textAlignment = UITextAlignmentCenter;

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

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

[refreshHeaderView addSubview:refreshLabel];
Expand Down