UITableViewController 滚动引起的cocos2d动画暂停问题的解决
动画 解决 滚动 cocos2d 引起 暂停 问题
2023-09-27 14:28:40 时间
UITableViewController 滚动引起的cocos2d动画暂停问题的解决
之前在使用UITableViewController进行滚动时,cocos2d的动画会暂停,直至滚动完毕才会继续动画。
后来发现可以这样解决,想要了解更多,请查阅NSRunLoop相关知识。
// .h
NSTimer* m_timer;
// .m
- (void)updateCCDirector { [[CCDirector sharedDirector] drawScene]; if (!self.tableView.dragging) { [m_timer invalidate]; m_timer = nil; } } - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { if (m_timer == nil) { m_timer = [NSTimer scheduledTimerWithTimeInterval:1.0/60 target:self selector:@selector(updateCCDirector) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:m_timer forMode:NSRunLoopCommonModes]; } }
相关文章
- matplotlib animation 绘制动画
- Android 动画:你真的会使用插值器与估值器吗?
- css:animation@keyframes 实现 CD播放旋转动画效果
- LICEcap 简洁易用的动画屏幕录制软件
- 使用flash导出图集动画到unity
- Canvas 示例:4种超炫的网站动画背景效果
- 修改ViewPager调用setCurrentItem时,滑屏的速度 ,解决滑动之间切换动画难看
- Unity3d解决Fbx动画不可用:The AnimationClip ‘xxx‘ used by the Animation component ‘xxx‘ must be marked...
- 集成AndroidViewAnimations实现安卓动画
- [译] Android 如何实现气泡选择动画
- Delphi 2005 以上版本GIF动画播放设置
- 重学前端 39 # CSS的动画和交互
- React Native进阶之Animated动画库详解
- vc应用CPictureEx类(重载CStatic类)加载gif动画