diff --git a/SSPullToRefresh/SSPullToRefreshDefaultContentView.m b/SSPullToRefresh/SSPullToRefreshDefaultContentView.m index c29c957..6112c3b 100644 --- a/SSPullToRefresh/SSPullToRefreshDefaultContentView.m +++ b/SSPullToRefresh/SSPullToRefreshDefaultContentView.m @@ -20,24 +20,24 @@ - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { CGFloat width = self.bounds.size.width; - _statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 14.0f, width, 20.0f)]; + _statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 14.0, width, 20.0)]; _statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; - _statusLabel.font = [UIFont boldSystemFontOfSize:14.0f]; + _statusLabel.font = [UIFont boldSystemFontOfSize:14.0]; _statusLabel.textColor = [UIColor blackColor]; _statusLabel.backgroundColor = [UIColor clearColor]; _statusLabel.textAlignment = NSTextAlignmentCenter; [self addSubview:_statusLabel]; - _lastUpdatedAtLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 34.0f, width, 20.0f)]; + _lastUpdatedAtLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 34.0, width, 20.0)]; _lastUpdatedAtLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; - _lastUpdatedAtLabel.font = [UIFont systemFontOfSize:12.0f]; + _lastUpdatedAtLabel.font = [UIFont systemFontOfSize:12.0]; _lastUpdatedAtLabel.textColor = [UIColor lightGrayColor]; _lastUpdatedAtLabel.backgroundColor = [UIColor clearColor]; _lastUpdatedAtLabel.textAlignment = NSTextAlignmentCenter; [self addSubview:_lastUpdatedAtLabel]; _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - _activityIndicatorView.frame = CGRectMake(30.0f, 25.0f, 20.0f, 20.0f); + _activityIndicatorView.frame = CGRectMake(30.0, 25.0, 20.0, 20.0); [self addSubview:_activityIndicatorView]; } return self; diff --git a/SSPullToRefresh/SSPullToRefreshSimpleContentView.m b/SSPullToRefresh/SSPullToRefreshSimpleContentView.m index 930ef2b..cafbfb9 100644 --- a/SSPullToRefresh/SSPullToRefreshSimpleContentView.m +++ b/SSPullToRefresh/SSPullToRefreshSimpleContentView.m @@ -20,16 +20,16 @@ - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { CGFloat width = self.bounds.size.width; - _statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 14.0f, width, 20.0f)]; + _statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 14.0, width, 20.0)]; _statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; - _statusLabel.font = [UIFont boldSystemFontOfSize:14.0f]; + _statusLabel.font = [UIFont boldSystemFontOfSize:14.0]; _statusLabel.textColor = [UIColor blackColor]; _statusLabel.backgroundColor = [UIColor clearColor]; _statusLabel.textAlignment = NSTextAlignmentCenter; [self addSubview:_statusLabel]; _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - _activityIndicatorView.frame = CGRectMake(30.0f, 25.0f, 20.0f, 20.0f); + _activityIndicatorView.frame = CGRectMake(30.0, 25.0, 20.0, 20.0); [self addSubview:_activityIndicatorView]; } return self; @@ -38,8 +38,8 @@ - (id)initWithFrame:(CGRect)frame { - (void)layoutSubviews { CGSize size = self.bounds.size; - self.statusLabel.frame = CGRectMake(20.0f, roundf((size.height - 30.0f) / 2.0f), size.width - 40.0f, 30.0f); - self.activityIndicatorView.frame = CGRectMake(roundf((size.width - 20.0f) / 2.0f), roundf((size.height - 20.0f) / 2.0f), 20.0f, 20.0f); + self.statusLabel.frame = CGRectMake(20.0, round((size.height - 30.0) / 2.0), size.width - 40.0, 30.0); + self.activityIndicatorView.frame = CGRectMake(round((size.width - 20.0) / 2.0), round((size.height - 20.0) / 2.0), 20.0, 20.0); } @@ -50,28 +50,28 @@ - (void)setState:(SSPullToRefreshViewState)state withPullToRefreshView:(SSPullTo case SSPullToRefreshViewStateReady: { self.statusLabel.text = NSLocalizedString(@"Release to refresh", nil); [self.activityIndicatorView startAnimating]; - self.activityIndicatorView.alpha = 0.0f; + self.activityIndicatorView.alpha = 0.0; break; } case SSPullToRefreshViewStateNormal: { self.statusLabel.text = NSLocalizedString(@"Pull down to refresh", nil); - self.statusLabel.alpha = 1.0f; + self.statusLabel.alpha = 1.0; [self.activityIndicatorView stopAnimating]; - self.activityIndicatorView.alpha = 0.0f; + self.activityIndicatorView.alpha = 0.0; break; } case SSPullToRefreshViewStateLoading: { - self.statusLabel.alpha = 0.0f; + self.statusLabel.alpha = 0.0; [self.activityIndicatorView startAnimating]; - self.activityIndicatorView.alpha = 1.0f; + self.activityIndicatorView.alpha = 1.0; break; } case SSPullToRefreshViewStateClosing: { self.statusLabel.text = nil; - self.activityIndicatorView.alpha = 0.0f; + self.activityIndicatorView.alpha = 0.0; break; } } diff --git a/SSPullToRefresh/SSPullToRefreshView.h b/SSPullToRefresh/SSPullToRefreshView.h index e874cdd..94e8449 100644 --- a/SSPullToRefresh/SSPullToRefreshView.h +++ b/SSPullToRefresh/SSPullToRefreshView.h @@ -156,13 +156,13 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) { animate down the pull to refresh view to show that it's loading. */ - (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated; -- (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated completion:(void(^)())block; +- (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated completion:(void(^)(void))block; /** Call this when you finish loading. */ - (void)finishLoading; -- (void)finishLoadingAnimated:(BOOL)animated completion:(void(^)())block; +- (void)finishLoadingAnimated:(BOOL)animated completion:(void(^)(void))block; /** Manually update the last updated at time. This will automatically get called when the pull to refresh view finishes laoding. diff --git a/SSPullToRefresh/SSPullToRefreshView.m b/SSPullToRefresh/SSPullToRefreshView.m index dd35173..24a9cb0 100644 --- a/SSPullToRefresh/SSPullToRefreshView.m +++ b/SSPullToRefresh/SSPullToRefreshView.m @@ -48,7 +48,7 @@ - (void)setState:(SSPullToRefreshViewState)state { [delegate pullToRefreshViewDidFinishLoading:self]; } } else if (!wasLoading && _state == SSPullToRefreshViewStateLoading) { - [self _setPullProgress:1.0f]; + [self _setPullProgress:1.0]; if ([delegate respondsToSelector:@selector(pullToRefreshViewDidStartLoading:)]) { [delegate pullToRefreshViewDidStartLoading:self]; } @@ -58,7 +58,7 @@ - (void)setState:(SSPullToRefreshViewState)state { - (void)setExpanded:(BOOL)expanded { _expanded = expanded; - [self _setContentInsetTop:expanded ? self.expandedHeight : 0.0f]; + [self _setContentInsetTop:expanded ? self.expandedHeight : 0.0]; } @@ -138,7 +138,7 @@ - (void)layoutSubviews { } CGRect contentFrame; - contentFrame.origin.x = roundf((size.width - contentSize.width) / 2.0f); + contentFrame.origin.x = round((size.width - contentSize.width) / 2.0); contentFrame.size = contentSize; switch (self.style) { case SSPullToRefreshViewStyleScrolling: @@ -156,7 +156,7 @@ - (void)layoutSubviews { #pragma mark - Initializer - (id)initWithScrollView:(UIScrollView *)scrollView delegate:(id)delegate { - CGRect frame = CGRectMake(0.0f, 0.0f - scrollView.bounds.size.height, scrollView.bounds.size.width, + CGRect frame = CGRectMake(0.0, 0.0 - scrollView.bounds.size.height, scrollView.bounds.size.width, scrollView.bounds.size.height); if ((self = [super initWithFrame:frame])) { for (UIView *view in self.scrollView.subviews) { @@ -169,7 +169,7 @@ - (id)initWithScrollView:(UIScrollView *)scrollView delegate:(id scrollView). - if (self.scrollView.contentOffset.y <= 0.0f) { - [self.scrollView scrollRectToVisible:CGRectMake(0.0f, 0.0f, 1.0f, 1.0f) animated:NO]; + if (self.scrollView.contentOffset.y <= 0.0) { + [self.scrollView scrollRectToVisible:CGRectMake(0.0, 0.0, 1.0, 1.0) animated:NO]; } // Tell the delegate @@ -335,7 +335,7 @@ - (void)_setPullProgress:(CGFloat)pullProgress { } // Ensure the value is between 0 and 1 (or higher if they keep pulling) - pullProgress = fmaxf(0.0f, pullProgress); + pullProgress = fmax(0.0, pullProgress); // Notify the content view [self.contentView setPullProgress:pullProgress]; @@ -372,7 +372,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N [self _setPullProgress:-y / self.expandedHeight]; // Dragged enough to refresh - if (y > -self.expandedHeight && y < 0.0f) { + if (y > -self.expandedHeight && y < 0.0) { self.state = SSPullToRefreshViewStateNormal; } // Scroll view is normal @@ -386,7 +386,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } // Scroll view is loading } else if (self.state == SSPullToRefreshViewStateLoading) { - CGFloat insetAdjustment = y < 0 ? fmaxf(0, self.expandedHeight + y) : self.expandedHeight; + CGFloat insetAdjustment = y < 0 ? fmax(0, self.expandedHeight + y) : self.expandedHeight; [self _setContentInsetTop:self.expandedHeight - insetAdjustment]; } return;