【发布时间】:2014-09-11 21:47:32
【问题描述】:
我的问题:
我有一个导航控制器。当我导航到应用程序的特定部分时,我会初始化此代码:http://rdsquared.wordpress.com/2012/10/19/circular-scrolling-inertia/
有了这个我有一个图像,我可以用我的手指旋转。它使用自定义委托。如果图像旋转,并且我按下后退按钮(或向后滑动)应用程序崩溃。
在代码中是这样写的:
// Taking a risk here that the delegate will not change or be destroyed while we're in the middle of animating the deceleration
if (self.delegate != NULL && [self.delegate respondsToSelector:@selector(rotationDidChangeByAngle:)]) {
当应用程序崩溃时,它会在此时崩溃:(因为当用户返回时委托被销毁)
[self.delegate rotationDidChangeByAngle:changeThisFrame];
我正在尝试理解和重写代码,这就是为什么我一直引用其他人的源代码。
我想做的事:
我希望能够旋转图像,然后在减速时按后退按钮。 (然后让图像在屏幕外停止)
任何人都可以想出解决委托问题的方法吗?请查看 Ryan 的源代码以获取更多信息。非常感谢你。
【问题讨论】:
标签: ios objective-c uinavigationcontroller delegates rotation