Comments (12)
Thanks for reporting!
I will answer you in about 5 hours. I have some meetings I need to attend to first.
How did you add the AGWindowView and how did you time it in regards of the navigation controller
from agwindowview.
I add it by below code:
AGWindowView *rootView = [[[AGWindowView alloc] init] autorelease];
rootView.supportedInterfaceOrientations = UIInterfaceOrientationMaskAllButUpsideDown;
[rootView addSubview:myView];
I don't clear understand the "how did you time it in regards of the navigation controller", but i pop the controller use below code, use system default animation time, and not hide the navigation bar
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
nav.navigationBarHidden = h;
nav.modalPresentationStyle = UIModalPresentationFormSheet;
nav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[_viewController presentModalViewController:nav animated:YES];
[nav release];
I also try to change the code in didMoveToWindow to
- (void)didMoveToWindow
{
[super didMoveToWindow];
if(self.window == nil)
{
self.onDidMoveOutOfWindow ? self.onDidMoveOutOfWindow() : nil;
[_activeWindowViews removeObject:self];
}
else
{
self.onDidMoveToWindow ? self.onDidMoveToWindow() : nil;
[_activeWindowViews addObject:self];
[self performSelector:@selector(rotateAccordingToStatusBarOrientationAndSupportedOrientations) withObject:nil afterDelay:1.0f];
// [self rotateAccordingToStatusBarOrientationAndSupportedOrientations];
}
}
It also can work, but I think the code update layout code no need
from agwindowview.
Thanks for adding more details.
- You display some custom view using AGWindowView
- You present some navigation controller using -[UIViewController presentModalViewController:animated:]
- You rotate 90 degress
- You pop the navigation controller
- Problem is visible
Is this is a correct understanding?
The problem as I understand it is that the AGWindowView is not placed correctly after step 1 to 4. Is that correct? OR is the problem that the rootviewcontroller is positioned wrongly? Can you please attach a screenshot? Please describe the problem / symptoms more in details.
Note:
It is necessary to call -[AGWindowView rotateAccordingToStatusBarOrientationAndSupportedOrientations] after adding it to UIWindow (e.g. didMoveToWindow) since it ensures the position and rotation is correct.
from agwindowview.
The Problem is occurred on step 4, step 4 will the trigger the AGWindowView move to the keywindow,
The Screen Shot:
from agwindowview.
On the image you've posted it seems like something is misplaced with origin {90, 90} not {80, 80} as you mentioned, but that's minor details.
I also assume the white view is the AGWindowView, is that correct?
I assume the black view is a subview of AGWindowView, is that correct?
If you pause the console and write this in the debugger
po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]
can you please paste the output?
from agwindowview.
I also assume the white view is the AGWindowView, is that correct? YES
I assume the black view is a subview of AGWindowView, is that correct? YES
and i make a Demo https://www.box.com/s/8pd953j7lm1d4ts1uxpz for you
from agwindowview.
Thank you for creating that demo-application. That was most helpfull!
I am sorry to say you are not using AGWindowView as intended. I have now implemented some exception for this case. The problem is that you set AGWindowView to be the first UIView on UIWindow. UIWindow already handles rotations on the first UIView. I've created some samples in a demo-project you can look at (added to repo).
To fix your demo I did like this
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Pop" forState:UIControlStateNormal];
[button addTarget:self action:@selector(onPopUpButton:) forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(100, 100, 100, 50)];
UIView *view = [[UIView alloc] init];
view.backgroundColor = [UIColor whiteColor];
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[view addSubview:button];
self.view = view;
}
- (void)onPopUpButton:(id)sender
{
UIViewController *controller = [[UIViewController alloc] init];
controller.view.backgroundColor = [UIColor redColor];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
nav.navigationBar.topItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(onPopUpDismiss:)];
AGWindowView *windowView = [[AGWindowView alloc] initAndAddToKeyWindow];
windowView.controller = nav;
[windowView addSubviewAndFillBounds:nav.view withSlideUpAnimationOnDone:^{
}];
self.popUpNav = nav;
}
- (void)onPopUpDismiss:(id)sender
{
if (self.popUpNav)
{
AGWindowView *windowView = [AGWindowView activeWindowViewForController:self.popUpNav];
[windowView slideDownSubviewsAndRemoveFromSuperview:^{
}];
}
}
from agwindowview.
Ok, as you say, I can use a normal UIView as the UIWindow's first view, and window can handle rotation corretly? Before I use the UINavigationController's view as the first view, because I find some bug and mistake think it has relationship with UIView as UIWindow's subview, then i choose AGWindowView to replace .
so this no need I can switch back to UIView?
from agwindowview.
Yes. AGWindowView is mostly meant for overviews and fullscreen experience on top of standard UI. So AGWindowView should never be first subview on window.
You should use standard UIView as first subview.
from agwindowview.
I've updated the readme with some examples of when to use it :)
from agwindowview.
Thanks very much!
from agwindowview.
No problem ! :)
from agwindowview.
Related Issues (17)
- Podspec HOT 4
- WindowView not overlaying keyboard HOT 6
- AGWindowView not work well in iOS8 HOT 14
- iOS8 HOT 3
- Rotation not working when other view controllers are presented on top HOT 10
- iOS 7 Support? HOT 8
- AirPlay device picker broken on iOS8 iPad HOT 4
- iOS8 UIActivityViewController problem on iPhone HOT 1
- UIWebView Add as SubView HOT 5
- initAndAddToKeyWindow does not dispatch touch events to subviews HOT 5
- New maintainer of AGWindowView wanted
- Getting crash when removing. HOT 4
- In AGWindowView.m, 'Convenience' is misspelled HOT 1
- iOS 5 Support? HOT 8
- Rotation should be possible even with locked statusBar orientation HOT 4
- Subviews do not get Layouted on Rotation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agwindowview.