diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h index 7ce16501..f26d3fcd 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h @@ -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; diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m index e43490ec..ac76c5f8 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m @@ -294,6 +294,8 @@ - (void)setState:(SVInfiniteScrollingState)newState { case SVInfiniteScrollingStateLoading: [self.activityIndicatorView startAnimating]; break; + default: + break; } } diff --git a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m index ba19078c..6073f321 100644 --- a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m +++ b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m @@ -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);