Мне это просто кажется неправильным.Пусть UIKit обрабатывает, когда эти методы вызываются.
Сделайте это вместо:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated]; // Always call super with this!!!
[self doSomeCustomLayoutStuff]; // I don't actually think this is necessary. viewWillLayoutSubviews is meant for laying out subviews, and gets called automatically in iOS 5 and beyond.
}
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
[self doSomeCustomLayoutStuff];
}
- (void)doSomeCustomLayoutStuff {
scrollView.frame = self.view.bounds;
scrollView.center = CGRectGetCenter(self.view.bounds);
if (imageView.image)
{
float scalex = scrollView.frame.size.width / imageView.image.size.width;
float scaley = scrollView.frame.size.height / imageView.image.size.height;
scrollView.zoomScale = MIN(scalex, scaley);
scrollView.minimumZoomScale = MIN(scalex, scaley);
}
}