avoid isnan() for pre-iOS 6 deployment
Showing
1 changed file
with
8 additions
and
2 deletions
@@ -37,8 +37,11 @@ | @@ -37,8 +37,11 @@ | ||
37 | if (self.mapScrollViewDelegate) | 37 | if (self.mapScrollViewDelegate) |
38 | [self.mapScrollViewDelegate scrollView:self correctedContentOffset:&contentOffset]; | 38 | [self.mapScrollViewDelegate scrollView:self correctedContentOffset:&contentOffset]; |
39 | 39 | ||
40 | - if ( ! isnan(contentOffset.x) && ! isnan(contentOffset.y)) | 40 | + if ( ! [[NSDecimalNumber notANumber] isEqualToNumber:@(contentOffset.x)] && |
41 | + ! [[NSDecimalNumber notANumber] isEqualToNumber:@(contentOffset.y)]) | ||
42 | + { | ||
41 | [super setContentOffset:contentOffset]; | 43 | [super setContentOffset:contentOffset]; |
44 | + } | ||
42 | } | 45 | } |
43 | 46 | ||
44 | - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated | 47 | - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated |
@@ -46,8 +49,11 @@ | @@ -46,8 +49,11 @@ | ||
46 | if (self.mapScrollViewDelegate) | 49 | if (self.mapScrollViewDelegate) |
47 | [self.mapScrollViewDelegate scrollView:self correctedContentOffset:&contentOffset]; | 50 | [self.mapScrollViewDelegate scrollView:self correctedContentOffset:&contentOffset]; |
48 | 51 | ||
49 | - if ( ! isnan(contentOffset.x) && ! isnan(contentOffset.y)) | 52 | + if ( ! [[NSDecimalNumber notANumber] isEqualToNumber:@(contentOffset.x)] && |
53 | + ! [[NSDecimalNumber notANumber] isEqualToNumber:@(contentOffset.y)]) | ||
54 | + { | ||
50 | [super setContentOffset:contentOffset animated:animated]; | 55 | [super setContentOffset:contentOffset animated:animated]; |
56 | + } | ||
51 | } | 57 | } |
52 | 58 | ||
53 | - (void)setContentSize:(CGSize)contentSize | 59 | - (void)setContentSize:(CGSize)contentSize |
-
Please register or login to post a comment