Scrollview scrollt nach erstmaligem Zoom nicht mehr

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Scrollview scrollt nach erstmaligem Zoom nicht mehr

    Hallo Zusammen,

    ich habe folgendes Problem mit einem ScrollView:

    Ein Bild mit 640 x 1536 Pixel ist im Imageview, Containerview, Scrollview.
    Zu Anfang kann ich Scrollen und Zoomen. Nach dem ersten Zoomen kann ich nur noch zoomen aber nicht mehr scrollen.

    Im Storyboard: View - Scrollview - Containerview - Imageview

    Da hab ich doch bestimmt was vergessen?

    Quellcode

    1. - (void)viewDidAppear:(BOOL)animated
    2. {
    3. [super viewDidAppear:animated];
    4. [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
    5. [self.view addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
    6. NSString *bildPfad;
    7. bildPfad = [[NSBundle mainBundle] pathForResource:@"Bild" ofType:@"png"];
    8. self.image = [[UIImage alloc]initWithContentsOfFile:bildPfad];
    9. self.imageView.image = [UIImage imageWithCGImage:[self.image CGImage] scale:(self.image.scale * 1.0) orientation:(self.image.imageOrientation)];
    10. [self.imageView setFrame:CGRectMake(0, 0, self.image.size.width, self.image.size.height)];
    11. [self.containerView setFrame:CGRectMake(0, 0, self.image.size.width, self.image.size.height)];
    12. self.scrollView.contentSize = self.containerView.frame.size;
    13. self.scrollView.minimumZoomScale = (self.view.frame.size.width / self.image.size.width) ;
    14. self.scrollView.maximumZoomScale = 2.0;
    15. self.scrollView.zoomScale = self.scrollView.minimumZoomScale;
    16. [self.scrollView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    17. }
    18. - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
    19. {
    20. return self.containerView;
    21. }
    Alles anzeigen