0
我加載ViewControllerA視圖控制器B.內這是一個小動畫人物,較大的場景中。動畫視圖控制器工作在iOS 5中,而不是iOS 4的
內ViewControllerA,有一個旋轉動畫,如:
CAKeyframeAnimation *bobble = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation"];
NSArray *times = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:0.25],
[NSNumber numberWithFloat:0.5],
[NSNumber numberWithFloat:0.75],
[NSNumber numberWithFloat:1.0],
nil];
[bobble setKeyTimes:times];
NSArray *values = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:degreesToRadian(0)],
[NSNumber numberWithFloat:degreesToRadian(5)],
[NSNumber numberWithFloat:degreesToRadian(0)],
[NSNumber numberWithFloat:degreesToRadian(-5)],
[NSNumber numberWithFloat:degreesToRadian(0)],
nil];
[bobble setValues:values];
bobble.repeatCount = HUGE_VALF;
bobble.autoreverses = YES;
bobble.duration = 5.0;
bobble.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
[self.view.layer addAnimation:bobble forKey:@"transform.rotation"];
它自己的viewDidLoad和viewDidAppear樣子:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.view.center = CGPointMake(640, 201);
[self.view setAnchorPointAndReposition:CGPointMake(.7, .7)];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self bobble];
[NSTimer scheduledTimerWithTimeInterval:3. target:self selector:@selector(blinkFromTimer:) userInfo:nil repeats:YES];
}
在iOS5的+ IT負載和動畫就好了,在IOS 4.3,它加載但不能看到動畫。
任何見解?
謝謝。其實,我絕不會創建這種類型的結構,但我繼承別人的項目,他們有它設置了這種方式。 – Fluffhead