UIViewContentModeScaleAspectFitプロパティを使用して、スクロールビューのサイズに合わせてscrollView内のimageViewを拡大/縮小できないようです。大きなUIImageがScroll Viewのフレームに縮尺されていない
- (void)loadView {
UIImage* image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.moilum.com/images/atomicongallery/setmenu/setmenu1.jpg"]]];
imageView = [[UIImageView alloc]initWithImage:image];
imageView.contentMode = UIViewContentModeScaleAspectFit;
CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
UIScrollView* scrollView = [[UIScrollView alloc]initWithFrame:applicationFrame];
[scrollView addSubview:imageView];
scrollView.contentSize = image.size;
scrollView.minimumZoomScale = 0.3;
scrollView.maximumZoomScale = 3.0;
scrollView.clipsToBounds = NO;
scrollView.delegate = self;
self.view = scrollView;
}
私もimageView.contentMode = UIViewContentModeScaleAspectFillを試みました。 scrollView.contentmode = UIViewContentModeScaleAspectFillも同様です。すべては!?
に:(
乾杯!
私はこれを試すものとありがとうございました! –
こんにちはJecht、あなたのコードが動作します!私は問題を発見した。デリゲートをスクロールビューに設定するたびに。 imageviewは設定されたcontentmodeに自身のサイズを変更しません。 scrollview.delegateの何かが、それが起こるのを止めます。また、私はどのようなdoesntがimageviewのサイズを変更された実装viewforScrollViewメソッドができると思う。ありがとう:) –