For loop deprecated on xCode 7.3

。_饼干妹妹 提交于 2019-12-14 02:24:34

问题


I realized that for loops are deprecated with the old system but have not been able to figure out what the problem is .. I've created this for loop in objective c now I would like to know if this with the introduction of xCode 7.3 way implement the for loop is deprecated or not. If the answer is you could give me an example of this my cycle on how to make non-deprecated? Yet I could not understand where is my mistake

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"];

    }

回答1:


C style for loops are deprecated in Swift, not in Objective C. Objective C is a super set of C and conforms to the C standard, so the C style for loop is never going away, especially since Apple doesn't release many Objective C changes these days.



来源:https://stackoverflow.com/questions/41012304/for-loop-deprecated-on-xcode-7-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!