我意識到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