变焦弹跳 +导航栏后退按钮点击 = 应用程序崩溃

发布于 2024-12-14 05:34:41 字数 1199 浏览 4 评论 0原文

今天我的应用程序崩溃了,我知道为什么。 我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初懵 2024-12-21 05:34:41

解决了。

问题是滚动视图委托触发事件反弹,但对象已经释放。删除委托,一切都很好。

- (void)viewWillDisappear:(BOOL)animated{    
    [scrollview setDelegate:nil];
}

亲切的问候。鲨鱼

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.

- (void)viewWillDisappear:(BOOL)animated{    
    [scrollview setDelegate:nil];
}

Kind regards. Sharky

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文