1
J'ai une vue de l'image qui est à l'intérieur d'un UIScrollView afin que je puisse pincer & zoom. Mon image semble bien en mode portrait, mais lorsque je passe à l'orientation horizontale, l'image n'est pas centrée.Comment puis-je centrer mon image dans une orientation horizontale?
L'UIScrollView est 320x460.
Voici mon code:
- (void)viewDidLoad {
[super viewDidLoad];
CGRect frame = CGRectMake(0, 0, 320, 460);
self.imageView = [[[AsyncImageView alloc]initWithFrame:frame] autorelease];
[self.imageView loadImageFromURL:self.url];
scrollView.contentSize = CGSizeMake(self.imageView.frame.size.width, self.imageView.frame.size.height);
scrollView.maximumZoomScale = 4.0;
scrollView.minimumZoomScale = 0.75;
scrollView.clipsToBounds = YES;
scrollView.delegate = self;
[scrollView addSubview:self.imageView];
}
Et la méthode déléguée UIScrollView
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return imageView;
}
Comment puis-je centrer mon image dans l'orientation horizontale?
Pas de chance, même résultat. –