0
我打電話與imgView滾動型內像這樣的觀點從另一種觀點認爲EXC_BREAKPOINT回去時滾動視圖來查看與imgview
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
ImageViewController *view = [[self.menus objectAtIndex:[indexPath row]] objectForKey:@"VIEW"];
view.imgPath = [[self.menus objectAtIndex:[indexPath row]] objectForKey:@"PATH"];
[self presentViewController:view animated:YES completion:nil];
}
那麼我告訴像這樣
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.imgView;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSString *path = [[NSBundle mainBundle] pathForResource:self.imgPath ofType:@"png"];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];
self.imgView = [[UIImageView alloc] initWithImage:image];
self.imgView.frame = (CGRect){.origin=CGPointMake(0.0f, 0.0f), .size=image.size};
[self.scrollView addSubview:self.imgView];
self.scrollView.contentSize = image.size;
CGRect scrollViewFrame = self.scrollView.frame;
CGFloat scaleWidth = scrollViewFrame.size.width/self.scrollView.contentSize.width;
CGFloat scaleHeight = scrollViewFrame.size.height/self.scrollView.contentSize.height;
CGFloat minScale = MIN(scaleWidth, scaleHeight);
self.scrollView.minimumZoomScale = minScale;
self.scrollView.maximumZoomScale = 1.0f;
self.scrollView.zoomScale = minScale;
[self centerScrollViewContents];
}
- (void)viewDidLoad
{
[super viewDidLoad];
UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewDoubleTapped:)];
doubleTapRecognizer.numberOfTapsRequired = 2;
doubleTapRecognizer.numberOfTouchesRequired = 1;
[self.scrollView addGestureRecognizer:doubleTapRecognizer];
UITapGestureRecognizer *twoFingerTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewTwoFingerTapped:)];
twoFingerTapRecognizer.numberOfTapsRequired = 1;
twoFingerTapRecognizer.numberOfTouchesRequired = 2;
[self.scrollView addGestureRecognizer:twoFingerTapRecognizer];
}
- (void)centerScrollViewContents {
CGSize boundsSize = self.scrollView.bounds.size;
CGRect contentsFrame = self.imgView.frame;
if (contentsFrame.size.width < boundsSize.width) {
contentsFrame.origin.x = (boundsSize.width - contentsFrame.size.width)/2.0f;
} else {
contentsFrame.origin.x = 0.0f;
}
if (contentsFrame.size.height < boundsSize.height) {
contentsFrame.origin.y = (boundsSize.height - contentsFrame.size.height)/2.0f;
} else {
contentsFrame.origin.y = 0.0f;
}
self.imgView.frame = contentsFrame;
}
新視圖圖像
這一切工作,沒有任何問題,我可以辭退這樣
- (IBAction)BackBtnPress:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
Howeve視圖R當我想從didSelectRowAtIndexPath方法再次返回到圖像視圖的應用程序崩潰,我在
0x18e2756: calll 0x1a37a00 ; symbol stub for: getpid
得到EXC_BREAKPOINT我試圖調試,並經過viewWillAppear中與seamingly沒有問題,然後崩潰
任何關於這個問題可能的想法?
謝謝!
編輯
使殭屍沒有幫助,禁止弧改變不了什麼。