flash animation I set a CalendarViewController's view as menuitem.view, when touch the bottom of menuitem.view, menuitem.view will begin animate, but i found the animation appears flashing. What can i do that make the animation become more smooth.
- (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));
}];
}
I gave up using this method, finaly, i work around the problem by draw a custom popoverView rather than use menuItem.view.