UIImage Is Not Fitting In UIScrollView At Start

后端 未结 5 955
-上瘾入骨i
-上瘾入骨i 2020-12-30 12:07

I have an image like:

\"Want

When I load the image to uiimageview and then adding as a subvie

5条回答
  •  无人及你
    2020-12-30 12:29

    Probably you are looking for this,

    UIImageView *tempImageView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Watson.jpg"]] autorelease];
    tempImageView.frame = scrollView.bounds;
    self.imageView = tempImageView;
    
    scrollView.backgroundColor = [UIColor blackColor];
    scrollView.minimumZoomScale = 1.0  ;
    scrollView.maximumZoomScale = imageView.image.size.width / scrollView.frame.size.width;
    scrollView.zoomScale = 1.0;
    scrollView.delegate = self;
    
    [scrollView addSubview:imageView];
    

提交回复
热议问题