-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
####问题####
应用启动后,创建root tabbar controller后,VHLNavigation.m: pushNeedDisplay不断空转
####原因####
启动后创建root tabbar controller的自控制器中,有控制器包含了循环动画,导致以下代码执行失败(不会执行)
[CATransaction setCompletionBlock:^{
[displayLink invalidate];
displayLink = nil;
vhlPushDisplayCount = 0;
[viewController setPushToCurrentVCFinished:YES];
}];
循环动画导致了CATransaction completion不会执行,从而最终导致空转
####复现####
目标controller
@implementation DisplayViewController
- (void)viewDidLoad {
[super viewDidLoad];
_testView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[self.view addSubview:_testView];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.fromValue = @(1);
animation.toValue = @(0);
animation.repeatCount = CGFLOAT_MAX;
animation.duration = 0.25;
[_testView.layer addAnimation:animation forKey:@"test"];
}
发起点击controller,“completed”不会打印
@implementation ViewController
- (IBAction)test:(id)sender {
DisplayViewController *vc = [[DisplayViewController alloc] init];
[CATransaction setCompletionBlock:^{
NSLog(@"completed");
}];
[CATransaction setAnimationDuration:10];
[CATransaction begin];
[self.navigationController pushViewController:vc animated:YES];
[CATransaction commit];
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels