what would be the best way to show a UIView on top of a UINavigationController when in landscape mode?
Trying
[self.navigationController.view addSubView: myView]
places myView under the Navigationbar.
[self.window addSubView: myView]
will show myView in portrait orientation (i.e. 90 degrees rotated to the left or right). I could rotate, but I hope there is a better solution.
Is there any way to cover the entire NavigationController with a UIView?
Maybe you can just hide the navigation bar of the Navigation Controller ?
Like this : self.navigationController.navigationBarHidden = YES
You can implement the following.
You only want the view to be there in landscape mode. So, you should do the following pice of code in
didRotateToInterfaceOrientation: method, hide the view when it rotates to potrait mode and show it when it rotates in landscape mode.
Hope this helps.
My solution was to add the view to UIWindow and rotate it depending on the current orientation.
Related
I want to fix the orientation of the keyboard.
My ViewController supports only Portrait.
If I rotate iPhone, the views in the ViewController does not rotate, but the keyboard appears in landscape.
I want to fix the portrait orientation of keyboard even if I rotate ViewController.
- (BOOL)shouldAutorotate
{
return NO;
}
This code does not work. I hear that UIWindow could be related..
Please give me how to solve this problem.
Set in taget-> General Choose portrait only.
In the View Controller, I set the navigation bar so that
self.navigationController.navigationBar.hidden = YES;
However, I am running into the issue that whichever way my UIViews are laid out in Storyboard, all the UIViews at runtime are moved down 64px. Is there a way that I could set so that both the NavBar is hidden, and that it does not affect how the UIViews are laid out on screen?
Thanks!
Usually , I use this to hide navigationBar.
[self.navigationController setNavigationBarHidden:YES];
While,
self.navigationController.navigationBar.hidden = YES;
Is the property for UIView, this is a method for UINavigationController.
I have a split view controller within a navigation controller and I want to put a DejalActivityView over everything it when I'm doing certain operations. Right now I'm using the following code:
- (void)showActivityView
{
UIView *viewToUse = [MSMasterViewController get].splitViewController.navigationController.view;
[DejalBezelActivityView activityViewForView:viewToUse];
[DejalActivityView currentActivityView].showNetworkActivityIndicator = YES;
}
This works in landscape mode, but when in portrait mode with the master view in popover form, the dejal activity view appears behind the popover. Is there a better view to use that will cover the whole screen?
Maybe you could use your Window as Superview, and only change relativ Frame positing.
greetings Oli
For All ViewControllers in my application I used Landscape mode ie I have Changed the Orientation option to LandScape in the Inspector Pane for the UIView of the ViewController in xib. I used the animation mentioned here.
As I don't want to keep many View Controllers in memory, while showing next ViewController I use to load them as rootViewController of the application key window
[UIView transitionWithView:self.window
duration:0.8
options:UIViewAnimationOptionTransitionFlipFromTop//But rotating left to roght in portrait mode
animations:^{
self.window.rootViewController = currentView;
}
completion:nil];
My problem is that during the animation phase Instead of animating in the landscape mode, the View is animated in portrait mode after the animation ends the View comes to the LanscapeMode,
I'm wondering why iPad project based on UITabBarController won't autorotate when i specify some of the tab should autorotate in landscape mode and the other will autorotate in landscape and portrait mode.
i've used the
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
for all the UIViewController and specify if landscape return YES; other wise return NO;
In the other hand, if the UIViewController should rotate in landscape and portrait i've justreturn YES;` always.
Thx in advance.
for all the UIViewController you are loading in tabbarcontroller you must return True in
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
Note:
A tab bar controller will not auto rotate unless ALL the controllers it contains also auto rotate.
from Rotate one UIViewController in UITabBar application -->>
There is no easy way to have only one view in landscape mode, while the others are in landscape, nor an easy way to programmatically switch to landscape mode.
One possible approach would be using a CGAffineTransform to transform your view in your viewWillAppear (i.e., right before the view is shown):
- (void)viewWillAppear:(BOOL)animated; {
//-- Adjust the status bar
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
//-- Rotate the view
CGAffineTransform toLandscape = CGAffineTransformMakeRotation(degreesToRadian(90));
toLandscape = CGAffineTransformTranslate(toLandscape, +90.0, +90.0 );
[self.view setTransform:toLandscape];
}