1
을 그리도록 설정 연신지고 장치가 회전 할 때 애스펙트가 유지되지 않고 늘어나는 것처럼 보입니다. 보기 모드는 redraw
으로 설정됩니다. 컨트롤러에서화상 장치 방향이 변경 될 때 <code>image</code>가 <code>zoom scale</code>가 <code>image</code>의 최대 값이 표시되도록 설정되어로드되면, 모드 그러나 ... I는 <code>UIScrollView</code>에 내장 <code>UIImageView</code>이
- (void)viewDidLoad
{
[super viewDidLoad];
self.scrollView.delegate = self;
// get the url of the photo from flickr
NSURL* url = [FlickrFetcher urlForPhoto:self.photo format:FlickrPhotoFormatLarge];
// set the scrollview's title to be the title of the picture
self.title = [self.photo objectForKey:FLICKR_PHOTO_TITLE];
// convert the url into an image
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:data];
// set the image as the image in the imageView
[self.imageView setImage:image];
// we will be scrolling over the size of the image
self.scrollView.contentSize = self.imageView.image.size;
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIInterfaceOrientation currOrient = self.interfaceOrientation;
self.imageView.frame = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);
if (currOrient == UIInterfaceOrientationPortrait || currOrient == UIInterfaceOrientationPortraitUpsideDown)
[self.scrollView setZoomScale: self.scrollView.frame.size.height/self.imageView.frame.size.height];
else {
[self.scrollView setZoomScale: self.scrollView.frame.size.width/self.imageView.frame.size.width];
}
// [self.imageView setNeedsDisplay];
// [self.scrollView setNeedsDisplay];
}
-(void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
{
scrollView.transform = CGAffineTransformIdentity;
}
위대한! 고마워, 그건 훌륭하게 작동! 나는 시도했다 - (void) willRotateToInterfaceOrientation : (UIInterfaceOrientation) toInterfaceOrientation duration : (NSTimeInterval) duration, 그러나 작동하지 않았다, 당신은 아마도 그 차이점을 설명 할 수 있고 왜 다른 방법을 구현하는 반면 해결하지 않았다 ? 다시 한 번 감사드립니다! – user1491896
willRotate는 회전하기 전에 전송됩니다. 회전은 다른 상황에서 사용되며 애니메이션 등을 사용 중지하기위한 것입니다. 따라서 애니메이션이 없습니다. willAnimate는 새로운 방향 정보와 애니메이션 기간을 제공합니다. 나는 이것이 iOS 3.0에서 차별화 된 것으로 생각한다. 즉, 애니메이션은 willAnimate에서만 허용된다. – Derek
다시 한번 감사드립니다. – user1491896