Skip to content

Commit

Permalink
Merge pull request samvermette#86 from jessedc/master
Browse files Browse the repository at this point in the history
Fixes for several compiler warnings
  • Loading branch information
samvermette committed Jan 15, 2013
2 parents fb45717 + 67cda76 commit b685d57
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ typedef NSUInteger SVInfiniteScrollingState;
- (void)startAnimating;
- (void)stopAnimating;

@end
@end
6 changes: 3 additions & 3 deletions SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ - (void)setState:(SVInfiniteScrollingState)newState {
if(hasCustomView) {
[self addSubview:customView];
CGRect viewBounds = [customView bounds];
CGPoint origin = CGPointMake(round((self.bounds.size.width-viewBounds.size.width)/2), round((self.bounds.size.height-viewBounds.size.height)/2));
CGPoint origin = CGPointMake(roundf((self.bounds.size.width-viewBounds.size.width)/2), roundf((self.bounds.size.height-viewBounds.size.height)/2));
[customView setFrame:CGRectMake(origin.x, origin.y, viewBounds.size.width, viewBounds.size.height)];
}
else {
CGRect viewBounds = [self.activityIndicatorView bounds];
CGPoint origin = CGPointMake(round((self.bounds.size.width-viewBounds.size.width)/2), round((self.bounds.size.height-viewBounds.size.height)/2));
CGPoint origin = CGPointMake(roundf((self.bounds.size.width-viewBounds.size.width)/2), roundf((self.bounds.size.height-viewBounds.size.height)/2));
[self.activityIndicatorView setFrame:CGRectMake(origin.x, origin.y, viewBounds.size.width, viewBounds.size.height)];

switch (newState) {
Expand All @@ -300,4 +300,4 @@ - (void)setState:(SVInfiniteScrollingState)newState {
self.infiniteScrollingHandler();
}

@end
@end
2 changes: 1 addition & 1 deletion SVPullToRefresh/UIScrollView+SVPullToRefresh.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ typedef NSUInteger SVPullToRefreshState;
// deprecated; use [self.scrollView triggerPullToRefresh] instead
- (void)triggerRefresh DEPRECATED_ATTRIBUTE;

@end
@end
16 changes: 9 additions & 7 deletions SVPullToRefresh/UIScrollView+SVPullToRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#import <QuartzCore/QuartzCore.h>
#import "UIScrollView+SVPullToRefresh.h"

//fequalzro() from http:https://stackoverflow.com/a/1614761/184130
#define fequalzero(a) (fabs(a) < FLT_EPSILON)

static CGFloat const SVPullToRefreshViewHeight = 60;

Expand Down Expand Up @@ -175,15 +177,15 @@ - (void)layoutSubviews {
float position = 0.50;

CGRect titleFrame = self.titleLabel.frame;
titleFrame.origin.x = ceil(remainingWidth*position+44);
titleFrame.origin.x = ceilf(remainingWidth*position+44);
self.titleLabel.frame = titleFrame;

CGRect dateFrame = self.subtitleLabel.frame;
dateFrame.origin.x = titleFrame.origin.x;
self.subtitleLabel.frame = dateFrame;

CGRect arrowFrame = self.arrow.frame;
arrowFrame.origin.x = ceil(remainingWidth*position);
arrowFrame.origin.x = ceilf(remainingWidth*position);
self.arrow.frame = arrowFrame;

self.activityIndicatorView.center = self.arrow.center;
Expand All @@ -203,7 +205,7 @@ - (void)layoutSubviews {
if(hasCustomView) {
[self addSubview:customView];
CGRect viewBounds = [customView bounds];
CGPoint origin = CGPointMake(round((self.bounds.size.width-viewBounds.size.width)/2), round((self.bounds.size.height-viewBounds.size.height)/2));
CGPoint origin = CGPointMake(roundf((self.bounds.size.width-viewBounds.size.width)/2), roundf((self.bounds.size.height-viewBounds.size.height)/2));
[customView setFrame:CGRectMake(origin.x, origin.y, viewBounds.size.width, viewBounds.size.height)];
}
else {
Expand All @@ -221,7 +223,7 @@ - (void)layoutSubviews {
break;

case SVPullToRefreshStateTriggered:
[self rotateArrow:M_PI hide:NO];
[self rotateArrow:(float)M_PI hide:NO];
break;

case SVPullToRefreshStateLoading:
Expand Down Expand Up @@ -429,7 +431,7 @@ - (void)triggerRefresh {
}

- (void)startAnimating{
if(self.scrollView.contentOffset.y == 0) {
if(fequalzero(self.scrollView.contentOffset.y)) {
[self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, -self.frame.size.height) animated:YES];
self.wasTriggeredByUser = NO;
}
Expand Down Expand Up @@ -518,7 +520,7 @@ - (void)drawRect:(CGRect)rect {

// Gradient Declaration
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGFloat alphaGradientLocations[] = {0, 0.8};
CGFloat alphaGradientLocations[] = {0, 0.8f};

CGGradientRef alphaGradient = nil;
if([[[UIDevice currentDevice] systemVersion]floatValue] >= 5){
Expand All @@ -529,7 +531,7 @@ - (void)drawRect:(CGRect)rect {
alphaGradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)alphaGradientColors, alphaGradientLocations);
}else{
const CGFloat * components = CGColorGetComponents([self.arrowColor CGColor]);
int numComponents = CGColorGetNumberOfComponents([self.arrowColor CGColor]);
int numComponents = (int)CGColorGetNumberOfComponents([self.arrowColor CGColor]);
CGFloat colors[8];
switch(numComponents){
case 2:{
Expand Down

0 comments on commit b685d57

Please sign in to comment.