我很难弄清楚为什么 Erica Sadun 在她的食谱示例 Ch07-11 中执行以下操作(在 viewDidLayoutSubviews 中调用 viewDidAppear)。也许这两种方法应该调用另一种方法?
见:https ://github.com/erica/iOS-5-Cookbook/tree/master/C07
- (void) viewDidAppear:(BOOL)animated
{
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);
}
}
- (void) viewDidLayoutSubviews
{
[self viewDidAppear:NO];
}
知道为什么吗?