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

Custom text for refresh view. #10

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
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,11 @@
*/
- (void)tableViewReloadFinished;

/**
* Custom text for refresh view.
*/
@property (nonatomic, weak) NSString *pullText;
@property (nonatomic, weak) NSString *releaseText;
@property (nonatomic, weak) NSString *loadingText;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,30 @@ - (void)tableViewReloadFinished {
[pullToRefreshView_ changeStateOfControl:MNMBottomPullToRefreshViewStateIdle offset:CGFLOAT_MAX];
}

#pragma mark -
#pragma mark properties
- (void)setPullText:(NSString *)pullText {
pullToRefreshView_.pullText = pullText;
}

- (void)setReleaseText:(NSString *)releaseText {
pullToRefreshView_.releaseText = releaseText;
}

- (void)setLoadingText:(NSString *)loadingText {
pullToRefreshView_.loadingText = loadingText;
}

- (NSString *)pullText {
return pullToRefreshView_.pullText;
}

- (NSString *)releaseText {
return pullToRefreshView_.releaseText;
}

- (NSString *)loadingText {
return pullToRefreshView_.loadingText;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ typedef enum {
*/
@property (nonatomic, readonly) CGFloat fixedHeight;

/**
* Custom text for refresh view.
*/
@property (nonatomic, weak) NSString *pullText;
@property (nonatomic, weak) NSString *releaseText;
@property (nonatomic, weak) NSString *loadingText;

/**
* Changes the state of the control depending on state value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ @implementation MNMBottomPullToRefreshView
@synthesize rotateIconWhileBecomingVisible = rotateIconWhileBecomingVisible_;
@dynamic isLoading;
@synthesize fixedHeight = fixedHeight_;
@synthesize pullText = pullText_;
@synthesize releaseText = releaseText_;
@synthesize loadingText = loadingText_;

#pragma mark -
#pragma mark Initialization
Expand Down Expand Up @@ -137,6 +140,10 @@ - (id)initWithFrame:(CGRect)frame {
fixedHeight_ = CGRectGetHeight(frame);
rotateIconWhileBecomingVisible_ = YES;

pullText_ = MNM_BOTTOM_PTR_PULL_TEXT_KEY;
releaseText_ = MNM_BOTTOM_PTR_RELEASE_TEXT_KEY;
loadingText_ = MNM_BOTTOM_PTR_LOADING_TEXT_KEY;

[self changeStateOfControl:MNMBottomPullToRefreshViewStateIdle offset:CGFLOAT_MAX];
}

Expand Down Expand Up @@ -182,7 +189,7 @@ - (void)changeStateOfControl:(MNMBottomPullToRefreshViewState)state offset:(CGFl

[loadingActivityIndicator_ stopAnimating];

[messageLabel_ setText:MNM_BOTTOM_PTR_PULL_TEXT_KEY];
[messageLabel_ setText:pullText_];

break;

Expand All @@ -199,15 +206,15 @@ - (void)changeStateOfControl:(MNMBottomPullToRefreshViewState)state offset:(CGFl
[iconImageView_ setTransform:CGAffineTransformIdentity];
}

[messageLabel_ setText:MNM_BOTTOM_PTR_PULL_TEXT_KEY];
[messageLabel_ setText:pullText_];

break;

} case MNMBottomPullToRefreshViewStateRelease: {

[iconImageView_ setTransform:CGAffineTransformMakeRotation(M_PI)];

[messageLabel_ setText:MNM_BOTTOM_PTR_RELEASE_TEXT_KEY];
[messageLabel_ setText:releaseText_];

height = fixedHeight_ + fabs(offset);

Expand All @@ -219,7 +226,7 @@ - (void)changeStateOfControl:(MNMBottomPullToRefreshViewState)state offset:(CGFl

[loadingActivityIndicator_ startAnimating];

[messageLabel_ setText:MNM_BOTTOM_PTR_LOADING_TEXT_KEY];
[messageLabel_ setText:loadingText_];

height = fixedHeight_ + fabs(offset);

Expand Down