만화책 용 ipad 앱에서 작업하고 있지만 작동하도록 스크롤보기를 가져올 수 없습니다. +만화 용 UIScroll보기
- 핀치 줌
- 회전
- 더블 탭 및 연재 만화
Here's 내가 35 http://vimeo.com/16073699 (둘째 싶어 무엇의 예에 의해 이동 : 나는 그것을 할 필요가 -)
지금은 핀치 확대/축소가 있지만 이미지를 회전하고 중심으로 스크롤 할 수 있습니다.
Here's 내 컨트롤러 코드 :
#define ZOOM_VIEW_TAG 100
#define ZOOM_STEP 2
#define PAGE_TIME 10
- (void)viewDidLoad{
[super loadView];
self.myImage.image = [UIImage imageNamed:@"Tira01.jpg"];
[self.myImage setTag:ZOOM_VIEW_TAG];
UISwipeGestureRecognizer *recognizer;
recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(Tap)];
[(UITapGestureRecognizer *)recognizer setNumberOfTouchesRequired:1];
[(UITapGestureRecognizer *)drecognizer setNumberOfTapsRequired:1];
[[self myImage] addGestureRecognizer:recognizer];
[recognizer release];
self.drecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[(UITapGestureRecognizer *)drecognizer setNumberOfTouchesRequired:1];
[(UITapGestureRecognizer *)drecognizer setNumberOfTapsRequired:2];
[[self myImage] addGestureRecognizer:drecognizer];
[drecognizer release];
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return [myScrollView viewWithTag:ZOOM_VIEW_TAG];
}
- (void)handleDoubleTap:(UIGestureRecognizer *)gestureRecognizer {
UIInterfaceOrientation currentOrientation = [[UIDevice currentDevice] orientation];
if(!self.zoomed)
{
// double tap zooms in
float newScale = [self.myScrollView zoomScale] * ZOOM_STEP;
CGRect zoomRect = [self zoomRectForScale:newScale withCenter:[gestureRecognizer locationInView:gestureRecognizer.view]];
[self.myScrollView zoomToRect:zoomRect animated:YES];
self.zoomed = YES;
}
else {
float newScale = [self.myScrollView zoomScale]/ZOOM_STEP;
CGRect zoomRect = [self zoomRectForScale:newScale withCenter:[gestureRecognizer locationInView:gestureRecognizer.view]];
[self.myScrollView zoomToRect:zoomRect animated:YES];
self.zoomed = NO;
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return YES;
}
- (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center {
CGRect zoomRect;
// the zoom rect is in the content view's coordinates.
// At a zoom scale of 1.0, it would be the size of the imageScrollView's bounds.
// As the zoom scale decreases, so more content is visible, the size of the rect grows.
zoomRect.size.height = [self.myScrollView frame].size.height/scale;
zoomRect.size.width = [self.myScrollView frame].size.width/scale;
// choose an origin so as to get the right center.
zoomRect.origin.x = center.x - (zoomRect.size.width/2.0);
zoomRect.origin.y = center.y - (zoomRect.size.height/2.0);
return zoomRect;
}
인터페이스 빌더에서 나는이 :
-> UIView의 (ScaleToFill 모드)
->있는 UIScrollView (ScaleToFill 모드)
---> UIImageView (AspectFit 모드)
나는 무엇을 해야할지 모르겠다. 잘못하고 있지만 나는 그걸로 미치겠 어 : (