From 14622fed977c8bb928b9c384716ffbe0d5d8cd1d Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 23 Jan 2011 02:51:32 +0100 Subject: [PATCH] In fact, we can't simply take the index 0 subview, it's always wrong in my project. Finally, I found a way to fix this issue, just add another check before the old code. --- Classes/ShareKit/Core/SHK.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Classes/ShareKit/Core/SHK.m b/Classes/ShareKit/Core/SHK.m index 7521b2a8..677b55cc 100644 --- a/Classes/ShareKit/Core/SHK.m +++ b/Classes/ShareKit/Core/SHK.m @@ -107,7 +107,16 @@ - (void)showViewController:(UIViewController *)vc } } - UIView *rootView = [[topWindow subviews] objectAtIndex:0]; + UIView *rootView = nil; + for (UIView *subView in [topWindow subviews]) { + if(strcmp(class_getName([subView class]),"UILayoutContainerView") == 0) { + rootView = subView; + break; + } + } + if (!rootView) { + rootView = [[topWindow subviews] objectAtIndex:0]; + } id nextResponder = [rootView nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]])