Я пытаюсь создать «обновленную» анимацию с помощью UIBarButtonItem, проблема в том, что она не только вращается, но и перемещает изображение вверх и вниз.Обновить анимацию на UIBarButtonItem
-(void)startRefreshButtonRotationAnimation {
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
rotationAnimation.duration = 1;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = 1000;
UIView *view = self.navigationItem.rightBarButtonItem.customView;
[view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
- (void)stopRefreshButtonRotationAnimation {
UIView *view = self.navigationItem.rightBarButtonItem.customView;
[view.layer removeAllAnimations];
}
Ну, я использовал систему один и имел ту же проблему! – apinho
UIBarButtonItem * refreshBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemRefresh target: self action: @selector (navigationBarRefreshButtonTapped)]; [self.navigationItem setRightBarButtonItem: refreshBarButtonItem]; – apinho