NSView Remove after animation

十年热恋 提交于 2019-12-09 07:41:31
rdelmar

Right after your beginGrouping statement, add this:

[[NSAnimationContext currentContext] setCompletionHandler:^{
        [self.blob removeFromSuperview];
    }];

setCompletionHandler: is a method in the NSAnimationContext class.

Jay

In case 10.6 or below (and thus NSAnimationContext's completionHandler) is not an option this approach just uses blocks and will work on 10.6+:

   double delayInSeconds = 1.0;
   dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
   dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
      [mySubView removeFromSuperview];
   });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!