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

update enum for swift usage #286

Open
wants to merge 3 commits 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
4 changes: 1 addition & 3 deletions SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
@end


enum {
typedef NS_ENUM(NSUInteger, SVInfiniteScrollingState) {
SVInfiniteScrollingStateStopped = 0,
SVInfiniteScrollingStateTriggered,
SVInfiniteScrollingStateLoading,
SVInfiniteScrollingStateAll = 10
};

typedef NSUInteger SVInfiniteScrollingState;

@interface SVInfiniteScrollingView : UIView

@property (nonatomic, readwrite) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
Expand Down
2 changes: 2 additions & 0 deletions SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ - (void)setState:(SVInfiniteScrollingState)newState {
case SVInfiniteScrollingStateLoading:
[self.activityIndicatorView startAnimating];
break;
default:
break;
}
}

Expand Down
15 changes: 8 additions & 7 deletions SVPullToRefresh/UIScrollView+SVPullToRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,15 @@ - (void)layoutSubviews {
self.subtitleLabel.text = subtitle.length > 0 ? subtitle : nil;


CGSize titleSize = [self.titleLabel.text sizeWithFont:self.titleLabel.font
constrainedToSize:CGSizeMake(labelMaxWidth,self.titleLabel.font.lineHeight)
lineBreakMode:self.titleLabel.lineBreakMode];
CGSize titleSize = [self.titleLabel.text boundingRectWithSize:CGSizeMake(labelMaxWidth, self.titleLabel.font.lineHeight)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:nil
context:nil].size;


CGSize subtitleSize = [self.subtitleLabel.text sizeWithFont:self.subtitleLabel.font
constrainedToSize:CGSizeMake(labelMaxWidth,self.subtitleLabel.font.lineHeight)
lineBreakMode:self.subtitleLabel.lineBreakMode];
CGSize subtitleSize = [self.subtitleLabel.text boundingRectWithSize:CGSizeMake(labelMaxWidth, self.subtitleLabel.font.lineHeight)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:nil
context:nil].size;

CGFloat maxLabelWidth = MAX(titleSize.width,subtitleSize.width);

Expand Down