Change UIInterfaceOrientation for only one UIViewController - uiviewcontroller

I have an app with one NavigationController and 4 UIViewController.
I like to have 3 UIViewController in UIInterfaceOrientationPortrait and one in the Landscape mode. The Landscape Orientation should appear immediately, when the view appears. Unfortunately, the mode changes only when I turn the device.
What can I do to change immediately to landscape without rotate the device?
Here is the code for my NavigationController.m
-(NSUInteger)supportedInterfaceOrientations
{
return [self.topViewController supportedInterfaceOrientations];
}
- (BOOL)shouldAutorotate
{
return [self.topViewController shouldAutorotate];
}
This is for the Portrait UIViewcontroller.m
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
And for the Landscape UIViewController.m :
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
// (iOS 6)
// Force to portrait
return UIInterfaceOrientationLandscapeRight;
}
In advance thanks for your help!

Related

#media display-mode: fullscreen does not work on Chrome Mobile

i want to add to my css
the fullscreen check, similar to this below :
#media all and (display-mode: fullscreen) {
body {
background-color: red;
}
}
this example has taken from here:
https://developer.mozilla.org/en-US/docs/Web/CSS/#media/display-mode
I would need it to work on Chrome mobile Android, but as of today, I'm trying but it doesn't work, although it is compatible, on other mobile browsers(Edge or Samsung browser) it works.
Note: to launch Fullscreen on browser i use something like :
function fullScreenMode() {
var doc = window.document;
var docEl = doc.documentElement;
var requestFullScreen = docEl.requestFullscreen();
requestFullScreen.call(docEl);
}
then fullScreenMode() via debug on Chrome:inspect on console,

How to force view controller orientation in iOS 10?

I have tried:
--> Subclassing UINavigationController and overriding autorotate methods
--> Overriding autorotate methods on MyViewController
--> And both.
Note: Also, I tried with autorotate sets NO and YES
This is my code:
NavigationControllerNoAutorotate:
#implementation NavigationControllerNoAutorotate
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationPortrait;
}
- (BOOL)shouldAutorotate {
return YES;
}
#end
MyViewController:
- (BOOL)shouldAutorotate {
return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController {
return UIInterfaceOrientationPortrait;
}
The problem was that I was testing on iPad, and I activated the SplitView on deployment info. When "Requires Full Screen" is YES, split view is deactivated.
I found the solution on this LINK

How to solve range slider zoom in ios

I am using a range slider in my site. site link . click on the options on the header and you will see the range slider. its ion range slider jquery plugin.
Its working good on desktop and android. But in ios, when i click on the range slider to change its automatically zoom which I don't want. i just need it plain as desktop.
and one more problem in ios. the search bar border has no radius but it shows radius on ios.
Can you please help me.
Thanks in advance.
Search Bar Radius:
for (UIView *searchBarSubview in [mySearchBar subviews])
{
if ([searchBarSubview conformsToProtocol:#protocol(UITextInputTraits)])
{
#try
{
[(UITextField *)searchBarSubview setBorderStyle:UITextBorderStyleRoundedRect];
}
#catch (NSException * e)
{
// ignore exception
}
}
}
(void)viewDidLoad
{
[super viewDidLoad];
UITextField *txfSearchField = [search valueForKey:#"_searchField"];
[txfSearchField setBackgroundColor:[UIColor whiteColor]];
[txfSearchField setLeftView:UITextFieldViewModeNever];
[txfSearchField setBorderStyle:UITextBorderStyleRoundedRect];
txfSearchField.layer.borderWidth = 8.0f;
txfSearchField.layer.cornerRadius = 20.0f;
txfSearchField.layer.borderColor = [UIColor clearColor].CGColor;
// Do any additional setup after loading the view, typically from a nib.
}

Keep UINavigationBar height with prefersStatusBarHidden

At certain times in my app I am hiding the UIStatusBar on iOS 7.
-(UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
return UIStatusBarAnimationFade;
}
-(BOOL)prefersStatusBarHidden {
if (self.state == StateModal) {
return YES;
}
return NO;
}
However, this the y-origin of the view controller's UINavigationBar. It moves up since there is not UIStatusBar visible, but I would like to retain the height of the status bar, but makes it's content invisible.
Is this possible? I don't have to take iOS 6 into account, just iOS 7.
You can change current window windowLevel to UIWindowLevelStatusBar, when controller is appeared
https://stackoverflow.com/a/21158994/2035054

How do I set an orientation specific background in a Windows Store Application?

I have a Windows Store Application where I've been supplied a different background image asset depending on whether the app is running in Portrait or Landscape mode.
Other than this background image, there are no other orientation specific differences.
What is the tidiest way to implement this requirement?
You can set it in Window.Current.SizeChanged handler:
Window.Current.SizeChanged += (sender, args) =>
{
if (ApplicationView.Value == ApplicationViewState.FullScreenLandscape)
{
// ...
}
else if (ApplicationView.Value == ApplicationViewState.FullScreenPortrait)
{
// ...
}
};