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
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