变焦弹跳 +导航栏后退按钮点击 = 应用程序崩溃
今天我的应用程序崩溃了,我知道为什么。 我有一个 UIViewController (图片类),上面有一个 ScrollView 和一个 ImageView。
@property (nonatomic, retain) IBOutlet UIScrollView *scrollview;
@property (nonatomic, retain) IBOutlet UIImageView *imageview;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator;
这是我通过 pushViewController:picAnimated:YES
调用的第三个视图。
这些是我的滚动视图配置(没有 initWithFrame):
[scrollview setBackgroundColor:[UIColor blackColor]];
[scrollview setShowsVerticalScrollIndicator:NO];
[scrollview setShowsHorizontalScrollIndicator:NO];
[scrollview setContentSize:scrollview.frame.size];
[scrollview setAlwaysBounceVertical:YES];
[scrollview setAlwaysBounceHorizontal:YES];
#warning BouncesZoom + BackButton = App Crash!
scrollview.bouncesZoom = YES;
scrollview.decelerationRate = UIScrollViewDecelerationRateFast;
[scrollview setDelegate:self];
所以现在我放大,当我停止拖动图片时,将调整大小回到最小尺寸。 如果我现在再次放大,按住拖动,用无名指按下导航控制器栏的后退按钮,应用程序就会崩溃:
2011-11-08 16:48:45.572 Archiv[1319:707] *** -[Picture respondsToSelector:]: message sent to deallocated instance 0x44e3960
你能帮我吗?请不要告诉我关闭bounceZoom。 $h@rky
today i crashed my app and i know why.
I have an UIViewController (class Picture) with an ScrollView and an ImageView on it.
@property (nonatomic, retain) IBOutlet UIScrollView *scrollview;
@property (nonatomic, retain) IBOutlet UIImageView *imageview;
@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator;
This is my third View which i call via pushViewController:pic animated:YES
These are my scrollview configurations (without initWithFrame):
[scrollview setBackgroundColor:[UIColor blackColor]];
[scrollview setShowsVerticalScrollIndicator:NO];
[scrollview setShowsHorizontalScrollIndicator:NO];
[scrollview setContentSize:scrollview.frame.size];
[scrollview setAlwaysBounceVertical:YES];
[scrollview setAlwaysBounceHorizontal:YES];
#warning BouncesZoom + BackButton = App Crash!
scrollview.bouncesZoom = YES;
scrollview.decelerationRate = UIScrollViewDecelerationRateFast;
[scrollview setDelegate:self];
So now I zoom in and when I stop dragging the picture resizes back to minimumSize.
If I now zoom in again, hold dragging, press the back button of the navigation controller bar with a third finger, the app crashes:
2011-11-08 16:48:45.572 Archiv[1319:707] *** -[Picture respondsToSelector:]: message sent to deallocated instance 0x44e3960
Can you help me? Please don't tell me to turn off bounceZoom.
$h@rky
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了。
问题是滚动视图委托触发事件反弹,但对象已经释放。删除委托,一切都很好。
亲切的问候。鲨鱼
Solved.
The problem is that the scrollview-delegate fires the event to bounce back but the object is already release. Remove the Delegate and everything is fine.
Kind regards. Sharky