0

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

- (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));
}];

}

4

1 回答 1

0

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

于 2017-03-22T01:12:42.233 回答