Skip to content

Commit 31fec48

Browse files
committed
Fixed more Xcode warnings.
1 parent ab6ece6 commit 31fec48

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

Classes/ProgressViews/M13ProgressViewPie.m

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
181181
- (void)animateProgress:(CADisplayLink *)displayLink
182182
{
183183
dispatch_async(dispatch_get_main_queue(), ^{
184-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
184+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
185185
if (dt >= 1.0) {
186186
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
187187
[self.displayLink invalidate];
188188
self.displayLink = nil;
189-
[super setProgress:_animationToValue animated:NO];
189+
[super setProgress:self.animationToValue animated:NO];
190190
[self setNeedsDisplay];
191191
return;
192192
}
193193

194194
//Set progress
195-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
195+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
196196
[self setNeedsDisplay];
197197

198198
});
@@ -230,9 +230,9 @@ - (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
230230
[CATransaction begin];
231231
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewPieHideKey];
232232
[CATransaction setCompletionBlock:^{
233-
_currentAction = action;
233+
self.currentAction = action;
234234
[self drawIcon];
235-
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
235+
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
236236
}];
237237
[CATransaction commit];
238238
}
@@ -254,9 +254,9 @@ - (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
254254
[CATransaction begin];
255255
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewPieHideKey];
256256
[CATransaction setCompletionBlock:^{
257-
_currentAction = action;
257+
self.currentAction = action;
258258
[self drawIcon];
259-
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
259+
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewPieShowKey];
260260
}];
261261
[CATransaction commit];
262262
}
@@ -272,7 +272,7 @@ - (void)setIndeterminate:(BOOL)indeterminate
272272

273273
//Create the rotation animation
274274
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
275-
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
275+
rotationAnimation.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
276276
rotationAnimation.duration = 1;
277277
rotationAnimation.cumulative = YES;
278278
rotationAnimation.repeatCount = HUGE_VALF;
@@ -290,7 +290,7 @@ - (void)setIndeterminate:(BOOL)indeterminate
290290
[_indeterminateLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewPieHideKey];
291291
[CATransaction setCompletionBlock:^{
292292
//Remove the rotation animation and reset the background
293-
[_backgroundLayer removeAnimationForKey:@"rotationAnimation"];
293+
[self.backgroundLayer removeAnimationForKey:@"rotationAnimation"];
294294
[self drawBackground];
295295
}];
296296
[CATransaction commit];
@@ -337,7 +337,7 @@ - (void)layoutSubviews
337337

338338
//Update line widths if not overriden
339339
if (!_backgroundRingWidthOverriden) {
340-
_backgroundRingWidth = fmaxf(self.frame.size.width * .025, 1.0);
340+
_backgroundRingWidth = fmaxf((float)self.frame.size.width * .025f, 1.0);
341341
}
342342

343343
//Redraw
@@ -443,8 +443,8 @@ - (void)drawFailure
443443
- (void)drawBackground
444444
{
445445
//Create parameters to draw background
446-
float startAngle = - M_PI_2;
447-
float endAngle = startAngle + (2.0 * M_PI);
446+
float startAngle = - (float)M_PI_2;
447+
float endAngle = (float)(startAngle + (2.0 * M_PI));
448448
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
449449
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
450450

@@ -461,8 +461,8 @@ - (void)drawBackground
461461
- (void)drawProgress
462462
{
463463
//Create parameters to draw progress
464-
float startAngle = - M_PI_2;
465-
float endAngle = startAngle + (2.0 * M_PI * self.progress);
464+
float startAngle = - (float)M_PI_2;
465+
float endAngle = (float)(startAngle + (2.0 * M_PI * self.progress));
466466
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
467467
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
468468

@@ -492,8 +492,8 @@ - (void)drawIcon
492492
- (void)drawIndeterminate
493493
{
494494
//Create parameters to draw progress
495-
float startAngle = - M_PI_2;
496-
float endAngle = startAngle + (2.0 * M_PI * .2);
495+
float startAngle = - (float)M_PI_2;
496+
float endAngle = (float)(startAngle + (2.0 * M_PI * .2));
497497
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
498498
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
499499

Classes/ProgressViews/M13ProgressViewRing.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ - (void)setup
8282
self.backgroundColor = [UIColor clearColor];
8383

8484
//Set defaut sizes
85-
_backgroundRingWidth = fmaxf(self.bounds.size.width * .025, 1.0);
85+
_backgroundRingWidth = fmaxf((float)self.bounds.size.width * .025f, 1.0);
8686
_progressRingWidth = 3 * _backgroundRingWidth;
8787
_progressRingWidthOverriden = NO;
8888
_backgroundRingWidthOverriden = NO;
@@ -250,9 +250,9 @@ - (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
250250
[CATransaction begin];
251251
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewRingHideKey];
252252
[CATransaction setCompletionBlock:^{
253-
_currentAction = action;
253+
self.currentAction = action;
254254
[self drawIcon];
255-
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
255+
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
256256
}];
257257
[CATransaction commit];
258258
}
@@ -270,9 +270,9 @@ - (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
270270
[CATransaction begin];
271271
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewRingHideKey];
272272
[CATransaction setCompletionBlock:^{
273-
_currentAction = action;
273+
self.currentAction = action;
274274
[self drawIcon];
275-
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
275+
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
276276
}];
277277
[CATransaction commit];
278278
}
@@ -288,7 +288,7 @@ - (void)setIndeterminate:(BOOL)indeterminate
288288

289289
//Create the rotation animation
290290
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
291-
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
291+
rotationAnimation.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
292292
rotationAnimation.duration = 1;
293293
rotationAnimation.cumulative = YES;
294294
rotationAnimation.repeatCount = HUGE_VALF;
@@ -357,7 +357,7 @@ - (void)layoutSubviews
357357

358358
//Update line widths if not overriden
359359
if (!_backgroundRingWidthOverriden) {
360-
_backgroundRingWidth = fmaxf(self.frame.size.width * .025, 1.0);
360+
_backgroundRingWidth = fmaxf((float)self.frame.size.width * .025f, 1.0);
361361
}
362362
if (!_progressRingWidthOverriden) {
363363
_progressRingWidth = _backgroundRingWidth * 3;
@@ -462,14 +462,14 @@ - (void)drawFailure
462462
- (void)drawBackground
463463
{
464464
//Create parameters to draw background
465-
float startAngle = - M_PI_2;
466-
float endAngle = startAngle + (2.0 * M_PI);
465+
float startAngle = - (float)M_PI_2;
466+
float endAngle = (float)(startAngle + (2.0 * M_PI));
467467
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
468468
CGFloat radius = (self.bounds.size.width - _backgroundRingWidth) / 2.0;
469469

470470
//If indeterminate, recalculate the end angle
471471
if (self.indeterminate) {
472-
endAngle = .8 * endAngle;
472+
endAngle = .8f * endAngle;
473473
}
474474

475475
//Draw path
@@ -485,8 +485,8 @@ - (void)drawBackground
485485
- (void)drawProgress
486486
{
487487
//Create parameters to draw progress
488-
float startAngle = - M_PI_2;
489-
float endAngle = startAngle + (2.0 * M_PI * self.progress);
488+
float startAngle = - (float)M_PI_2;
489+
float endAngle = (float)(startAngle + (2.0 * M_PI * self.progress));
490490
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.width / 2.0);
491491
CGFloat radius = (self.bounds.size.width - _progressRingWidth) / 2.0;
492492

@@ -500,7 +500,7 @@ - (void)drawProgress
500500
[_progressLayer setPath:path.CGPath];
501501

502502
//Update label
503-
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
503+
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
504504
}
505505

506506
- (void)drawIcon

Classes/ProgressViews/M13ProgressViewSegmentedRing.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,13 @@ - (void)setIndeterminate:(BOOL)indeterminate
310310

311311
//Create the rotation animation
312312
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
313-
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
313+
rotationAnimation.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
314314
rotationAnimation.duration = 5 * self.animationDuration;
315315
rotationAnimation.cumulative = YES;
316316
rotationAnimation.repeatCount = HUGE_VALF;
317317

318318
CABasicAnimation *rotationAnimationProgress = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
319-
rotationAnimationProgress.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
319+
rotationAnimationProgress.toValue = [NSNumber numberWithFloat: (float)(M_PI * 2.0)];
320320
rotationAnimationProgress.duration = 5 * self.animationDuration;
321321
rotationAnimationProgress.cumulative = YES;
322322
rotationAnimationProgress.repeatCount = HUGE_VALF;
@@ -384,7 +384,7 @@ - (void)layoutSubviews
384384

385385
//Update line widths if not overriden
386386
if (!_progressRingWidthOverriden) {
387-
_progressRingWidth = fmaxf(self.frame.size.width * .25, 1.0);
387+
_progressRingWidth = fmaxf((float)(self.frame.size.width * .25), 1.0);
388388
}
389389

390390
[self updateAngles];
@@ -418,14 +418,14 @@ - (void)updateAngles
418418
//Calculate the outer ring angle for the progress segment.*/
419419
outerRingAngle = ((2.0 * M_PI) / (float)_numberOfSegments) - _segmentSeparationAngle;
420420
//Calculate the angle gap for the inner ring
421-
_segmentSeparationInnerAngle = 2.0 * asinf(((self.bounds.size.width / 2.0) * sinf(_segmentSeparationAngle / 2.0)) / ((self.bounds.size.width / 2.0) - _progressRingWidth));
421+
_segmentSeparationInnerAngle = 2.0f * asinf((float)((self.bounds.size.width / 2.0) * sinf((float)_segmentSeparationAngle / 2.0f)) / (((float)self.bounds.size.width / 2.0f) - (float)_progressRingWidth));
422422
//Calculate the inner ring angle for the progress segment.*/
423423
innerRingAngle = ((2.0 * M_PI) / (float)_numberOfSegments) - _segmentSeparationInnerAngle;
424424
}
425425

426426
- (NSInteger)numberOfFullSegments
427427
{
428-
return (NSInteger)floorf(self.progress * _numberOfSegments);
428+
return (NSInteger)floorf((float)(self.progress * _numberOfSegments));
429429
}
430430

431431
#pragma mark Drawing
@@ -585,7 +585,7 @@ - (void)drawProgress
585585
CGPathRelease(pathRef);
586586

587587
//Update label
588-
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
588+
_percentageLabel.text = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
589589
}
590590

591591
- (void)drawIcon

0 commit comments

Comments
 (0)