1
我試圖用這個動畫改變我的視圖背景顏色,它應該從藍色變爲紅色變成綠色但它不會運行,我無法弄清楚我在做什麼錯誤。ObjC動畫不會運行
CAKeyframeAnimation * anim = [ CAKeyframeAnimation animationWithKeyPath:@"backgroundColor" ] ;
anim.values = @[ [UIColor blueColor],[UIColor redColor],[UIColor greenColor] ] ;
anim.autoreverses = NO;
anim.repeatCount = 7.20f ;
anim.duration = 0.1f ;
UIWindow *win = [[UIApplication sharedApplication]keyWindow];
[win.rootViewController.view.layer addAnimation:anim forKey:nil];