1
不知道爲什麼這不起作用。我不能爲新添加的子層做隱式動畫,除非有人甚至像觸發按鈕或從另一個方法調用它那樣觸發它。即使我認爲我應該這樣,下面的這個也不會生成動畫。它只顯示圖層的「之後」狀態。核心動畫隱式動畫不會爲新添加的子圖層啓動
CAGradientLayer *newBar = [CAGradientLayer layer];
CGFloat barHeight = ((pair.amount.floatValue/self.model.maxModelValue.floatValue)*maxBarHeight);
newBar.bounds=R(0,0,self.barWidth,0);
newBar.anchorPoint=P(0, 1);
newBar.position=P((i*barSpacing), self.insideLayer.bounds.size.height);
newBar.backgroundColor=self.lowerColor.CGColor;
newBar.colors=[NSArray arrayWithObjects:(id)self.upperColor.CGColor, self.lowerColor.CGColor, nil];
newBar.cornerRadius=self.cornerRadius;
newBar.opacity=1.0;
[self.insideLayer addSublayer:newBar];
//animation line:
newBar.opacity=0.5;
他媽的,謝謝你來搶!我以爲我是唯一一個瘋狂的人使用這種方法來解決新增圖層的presentationLayer問題。 – Andy