Hidden status bar intercepts touchs on iPad - ios

In my app I'm using UI for several first screens, and then switch to OpenGL view controller (cocos3d). I show status bar for UI view controllers, and then hide it before switching to OpenGL.
The strange thing is, that while running the app on iPhone all is good, but on iPad the hidden status bar starts to intercept all touches within its bounding box.
I have found this question, which refers to this one. There seems to be a bug of Simulator with the same behavior, but I encounter this on real devices (both iPhone and iPad are real devices).
I'm creating OpenGL view controller programmatically without differentiating like
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
In my .plistI have:
View controller-based status bar appearance = NO
To hide status bar I'm using:
[[UIApplication sharedApplication] setStatusBarHidden:NO];
Also, I'm targeting iOS 7.
I've almost got crazy about this, does someone encountered the same issue? How can I allow touches for status bar area?

Try putting this in the .m of the viewcontroller
- (BOOL)prefersStatusBarHidden {
return YES;
}

Related

iOS 8 Orientation Issues : Keyboard ends up in incorrect position

I have a universal project for iOS that was created in xCode 5 that I am trying to port to xCode 6. Everything seems to have been fine since I am not using LaunchScreen and iPhone 6 and 6 Plus scale the application to their resolutions.
The problem occurs when device changes its orientation.
Scenario:
It only occurs on iPhone 6 and 6 Plus.
Open Login screen with username and password fields. Rotate the device to Landscape, and tap username or password field. The keyboard appears in the middle of the screen with half cut. Rotating back to portrait hides the keyboard altogether and it no longer appears on screen no matter which field you tap on.
To get the keyboard back, rotate back to Landscape, tap on a field rotate device to opposite Landscape (don't let it go in Portrait). The keyboard suddenly becomes normal and acts fine.
I got the same problem, and that's because your app is launched in scaled mode.
It seems that Apple didn't go the full blown way to handle landscape in this scaled mode.
The solution is to switch to non-scaled mode for the iPhone 6-6Plus, using the trick specified here: How to enable native resolution for apps on iPhone 6 and 6 Plus?
Note that this will likely break a lot of your screens in the process.. but there's no other solution.
I have faced this issue with scalable mode of the app. Though supporting non-scalble mode (by adding iPhone 6 & 6+ launch images to xcassets) solves this problem, it was not permissible in my case as screens had static layout for each orientation.
I could solve this problem by avoiding the incidents of changing the root view controller of the window. Instead, the new view controllers have been added (with balancing removal) as subview (and hence childViewController) to the existing root view controller.
Everything is ok on iOS6/7, But not iOS8.
The orientation of the keyboard on iOS 8 is not the same as status bar.
If your application runs only portrait mode you can stop generating orientation notifications;
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
I have faced this issue, and after some research I found some stuff, that caused such bug.
In my AppDelegate I changed window rootViewController to show different ViewControllers depends of authorization status
if (!auth)
{
self.window.rootViewController = [[AuthViewController alloc] init];
} else {
self.window.rootViewController = [[DataViewController alloc] init];
}
I removed this and move controller select logic to NavigationViewController
if (!auth)
{
self.viewControllers = #[[[AuthViewController alloc] init]];
} else {
self.viewControllers = #[[[DataViewController alloc] init]];
}
and make this NavigationViewController as Storyboard initial view controller.
Hope it helps!

how to hide UIStatusbar on the ipad?

i was create the app for target for iphone in ios7. but when i tested that app into ipad then statusbar not hidden. in iphone its hide but not into ipad. please help me. i set the below code on my app.
i set this to appdelegate. but its not hide the statusbar for ipad.
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
i also set the View controller-based status bar appearance to NO and Status bar is initially hidden to YES into info.plist file.
Your code is correct, but since iOS 7 the iPad works slightly different with iPhone compatibility mode: the status bar is always visible, and there is no longer a 2x button to show the interface "zoomed in".
Even though your code will work fine on iPhone, the iPad will always display the status bar on iPhone apps.

Hiding the Status Bar for an iPhone app running on iPad

My iPhone app requires that the status bar be hidden at all times. This is generally easy to do, and it works if I only run the app on an iPhone. However, if I run the app on an iPad, the status bar still appears at the top of the content. So, how do I make sure the status bar is hidden no matter device my iPhone-only app is running on? I'm currently doing the following in my code:
Calling this method for each view controller(I actually created a category on UIViewController that implements this automatically for any VC, but it's basically the same as writing it in each vc file):
-(BOOL)prefersStatusBarHidden{
return YES;
}
I also set "status bar is initially hidden" to YES and "View controller-based status bar appearance" to NO in Info.plist. I've also tried detecting which device is being used and calling
[UIApplication sharedApplication]setSetStatusBarHidden:YES]
in the AppDelegate, but no luck there either. So, I believe I've tried just about everything that one would think to try.
It seems this was introduced into iOS 7.1 and affects non-retina iPads running iPhone applications with retina graphics.
No solution for developers. I think Apple will have to patch this one...
Problem devices:
iPad 2
iPad Mini (non-retina).
Problem does not exist in iOS 7.0 and status bar issues can be fixed for 7.0 with the other solutions posted.
Update for September 2014 - iOS 8:
This bug is fixed for iOS 8!!!!!
Add this code.
- (BOOL)prefersStatusBarHidden{
return YES;}
Add an property in YourViewController as
#property BOOL statusBarHidden;
and then in ViewDidLoad add the following lines of code
[self prefersStatusBarHidden];
[self performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
self.statusBarHidden = YES;
Then add an method in YourViewController
- (BOOL)prefersStatusBarHidden{
return YES;}
and also don't forgot to add the #import <UIKit/UIKit.h> in your code it works great for IOS6.1 & 7.0 :)

UINavigationBar mysteriously disappears in iOS 7

I started a project with Xcode 4, and today I updated my Xcode to 5. Running the same project in iOS7 simulator revealed some interesting (also frustrating) issues.
So my app has a sidebar that the user can tap on, and based on which button they tap on, I would instantiate a new VC using this code
YMGeneralInfoTableViewController *generalInfoTableVC = [self.storyboard instantiateViewControllerWithIdentifier:#"generalInfoTableVC"];
Then push this new VC onto the nav stack with this code
[self.navigationController pushViewController:generalInfoTableVC animated:YES];
Everything worked fine in iOS 6. However, in iOS7, the navbar magically disappears.
Here's a screen shot before pushing new VC
Here is after pushing it:
As you can see, there is a gap between where the content starts and the statusBar, in the position where the navBar should be.
I also tested out this code again on my iOS 6 device, everything is still fine on that iOS 6 device. So I am not sure what's going on here.
Also if I try to log the navBar/navigationItem of the controller where the navbar disappeared, I do get the correct reference to the navBar, which means that it is not nil, but simply not showing.
However, the methodsetHideNavigationBar:NO Animated:NO didn't bring the navBar back either. Does anyone know what's going on?
By the way, I've found the solution for this.
It is because in AppDelegate, you might already set some of appearance changes for the Navigation Bar.
So what I suggest you to do is to check the device OS first before set custom apperance for Navigation Bar?
- (BOOL)isOS7
{
float currentVersion = 7.0;
if ([[[UIDevice currentDevice] systemVersion] floatValue] < currentVersion)
return NO;
return YES;
}
So if return "NO" then only you do whatever possible that can be use for
Checkout Autolayout constraints,
I have tried same by using iOS 6 and iOS 7, my navigation bar is showing. Still checkout Autolayout constraints, i have doen it without autolayout

ipad tabbar rotation

please help with this noob questions but really making me go crazy>
if I create a project from scratch (using windows based app) for the ipad,
and add a tabbar , with firstviewController, and secondviewController, it works fine,
starts in landscape mode,
but in info.plist I set it to Landscape(left home button),
but really in simulator starts with the button on the right side!
in the FirstViewController.m
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight)
return YES;
else {
return NO; }}
so it starts in landscape, and rotates as the simulator rotates,
but if I create a template app for iphone tabbar,
set the info.plist
Initial interface orientation> Landscape (left home button)
and add the code above, IT DOESNT WORK!!!
simulator starts with button at left but tab bar on the side,
same problem that I had with an app that Im porting from iphone to ipad, (landscape intended)
I get to the landscape start mode, but the tab bar remains on the side!
also the only way to make the old ported app to show the simulator on the side was with
UIInterfaceOrientation UIIntefaceOrientationLandscapeLeft (didnt work with Initial interface orientation), does not let me choose the value for the key, but it shows the simulator on landscape,,
so,,
what can I do please to show the tab bar on landscape mode???
the tabbar from scratch was made to see if the code will work , but it didnt??
why does it work in the tab bar made from windows app and not tab bar app?
I just want the tab bar to show in landscape ahhh,
thanks
in the info.plist set Supported Interface Orientations

Resources