我意识到for循环被旧系统弃用,但一直未能找出问题所在。我已经创建了这个for循环的目标c现在我想知道如果这个与xCode 7.3的方式引入实现for循环是否被弃用。如果答案是你可以给我一个关于如何使不被弃用的循环的例子吗?但我不明白哪里是我的错For循环在xCode 7.3上弃用
for (NSInteger i = 0; i < self.valueForBar.count; i++) {
// Creazione delle barre in movimento
CGFloat columnWidth = 25;
CGFloat maximumValueOfBar = self.frame.size.height;
CGFloat index = [[self.valueForBar objectAtIndex:i] floatValue] /100;
CGFloat barWidth = 20;
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(15 +columnWidth *i,maximumValueOfBar -25)];
[path addLineToPoint:CGPointMake(15 +columnWidth *i,(maximumValueOfBar -25) - maximumValueOfBar * index)];
CAShapeLayer *pathLayer = [CAShapeLayer layer];
pathLayer.frame = self.scrollChart.bounds;
pathLayer.path = path.CGPath;
pathLayer.strokeColor = self.fillBarColor.CGColor;
pathLayer.fillColor = nil;
pathLayer.lineWidth = barWidth;
pathLayer.lineJoin = kCALineJoinBevel;
[self.scrollChart.layer addSublayer:pathLayer];
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 1;
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
[pathLayer addAnimation:pathAnimation forKey:@"strokeEnd"];
}
这些C风格的循环在** Swift **(仅)中已弃用。 – vadian