2017-03-09 143 views
0

flash animation 我设置CalendarViewController的视图为menuitem.view,当触摸menuitem.view的底部时,menuitem.view将开始动画,但我发现动画出现闪烁。我能做些什么让动画变得更加流畅。menuitem的视图动画出现闪烁

- (IBAction)respondToTapBottomView:(NSButton *)sender { 
NSSize size = self.view.frame.size; 
NSLog(@"%@", NSStringFromRect(self.view.window.frame)); 
[NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { 
    context.duration = 0.5; 
    CGFloat height = 10; 
    if (self.bottomContentHeightConstraint.constant >= 30) { 
     height = 10; 
    } else { 
     height = 97; 
    } 
    CGFloat windowHeight = self.calendarView.frame.size.height + height; 
    self.view.animator.frame = CGRectMake(0, 0, size.width, windowHeight); 
    self.bottomContentHeightConstraint.animator.constant = height; 
} completionHandler:^{ 
    NSLog(@"%@", NSStringFromRect(self.view.window.frame)); 
}]; 

}

回答

0

我放弃了使用这种方法,finaly,我解决该问题通过绘制一个自定义的popoverView而不是使用menuItem.view。