(「FirstVC」と言う)UINavigationController
を含む があります。UIViewController
この 'FirstVC' には が含まれてUIScrollView
おり、この各ページにUIScrollView
別のものを追加しましたUIViewCotroller
('SecondVC' など)。このSecondVCUIWebView
には、複数のリンクを持つ が含まれています。UIViewController
を持っている別のもの(「ThirdVC」など) をプッシュしたいと思いUIScrollView
ます。しかし、同じことをしようとすると、アプリケーションがクラッシュします。適用したコードは次のとおりです。
ファーストVC
- (void)viewDidLoad{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ShowThirdVCNotification:) name:@"ShowThirdVC" object:nil];
}
-(void)showAlbumNotification:(id)notificationObject{
NSLog(@"ShowThirdVCNotification: %@", [notificationObject object]);// It's an array
ThirdVC *controller = [[ThirdVC alloc] initWithNibName:@"ThirdVC" bundle:nil];
[controller setImageArr:[notificationObject object]];
[self.navigationController pushViewController:controller animated:NO];
}
/* SecondVC.view は、ロード時に FirstVC の scrollView に追加されます */
セカンドVC :
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSString *urlStr = [NSString stringWithFormat:@"%@", [request URL]];
if ([[urlStr lastPathComponent] rangeOfString:@".jpg"].length) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"ShowAlbum" object:self.imageDetailArr];
return NO;
}
return YES;
}
スレッド 1 では、以下がリストされます。
4 0x00b0a8ab in -[UIWebScrollView didMoveToWindow] ()
5 0x007a583e in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
6 0x007af6d1 in -[UIScrollView _didMoveFromWindow:toWindow:] ()
7 0x007a54bb in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
8 0x007a54bb in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
9 0x007a54bb in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
10 0x007af6d1 in -[UIScrollView _didMoveFromWindow:toWindow:] ()
11 0x007a54bb in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
12 0x007a54bb in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
13 0x007a1c72 in -[UIView(Hierarchy) _postMovedFromSuperview:] ()
14 0x007a04c6 in __UIViewWasRemovedFromSuperview ()
15 0x007a0141 in -[UIView(Hierarchy) removeFromSuperview] ()
16 0x009e69bb in -[UINavigationTransitionView _cleanupTransition] ()
17 0x009e6c86 in -[UINavigationTransitionView _navigationTransitionDidStop] ()
18 0x0079a499 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] ()
19 0x00799d6d in +[UIViewAnimationState popAnimationState] ()
20 0x007a326c in +[UIView(Animation) commitAnimations] ()
21 0x009e6702 in -[UINavigationTransitionView transition:fromView:toView:] ()
22 0x009e5ccb in -[UINavigationTransitionView transition:toView:] ()
23 0x008422b7 in -[UINavigationController _startTransition:fromViewController:toViewController:] ()
24 0x008423df in -[UINavigationController _startDeferredTransitionIfNeeded] ()
25 0x00842561 in -[UINavigationController __viewWillLayoutSubviews] ()
26 0x0095e4ca in -[UILayoutContainerView layoutSubviews] ()
27 0x007a8301 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()