Popup always shown in portrait regardless of rotation in some cases.
Closed this issue · 4 comments
In presentPointingAtBarButtonItem:
...
if ([targetSuperview isKindOfClass:[UINavigationBar class]]) {
containerView = [UIApplication sharedApplication].keyWindow;
}
This sets the containerView to the root UIWindow if the BarButtonItem is placed in a UINavigationBar.
It seems like UIWindow never rotates and is setting it's transformation instead.
http://lfhck.com/question/190884/after-rotation-uiview-coordinates-are-swapped-but-uiwindows-are-not
The popup is placed correctly but is not correctly rotated.
Then presentPointingAtView is called and that does a UIView* superView = containerView.superview, this retuned nil since keyWindow doesn't have any parent. superview is then used to convert between coordinate system. I tried to change this so that superView is set to containerview if nil but that didn't matter.
I want to know how to fix this issue as well!
Problem is that the view is incorrect, and points at the key window. May be a fix:
if ([targetSuperview isKindOfClass:[UINavigationBar class]]) {
UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topController.presentedViewController) {
topController = topController.presentedViewController;
}
containerView = topController.view;
}
github auto formatting isn't really working, is it ?
Should be fixed now.