UIScreen mainScreen bounds different between simulator and actual device on iOS8 - device

in my iOS7 app I use:
screenRect = [[UIScreen mainScreen] bounds];
screenWidth = screenRect.size.width;
screenHeight = screenRect.size.height;
I then use screenHeight for loading different view regarding if device is iPhone 4 or iPhone 5.
The main problem is, when I was checking the app for iOS 8 the simulator return exchanged values in landscape orientation so screenHeight vas actually screenWidth and it loads the wrong view. Ok I solved that, but we did not put any updates yet on App Store, because application is working just fine on actual device with iOS 8. It loads a proper view.
The actual device with iOS8 on landscape return values as before on iOS7, but on simulator iOS 8 the values are exchanged as they should be. Now it is very hard for me to decide if I put an update or not.
Does anybody know what is happening?
Thank you, Matej

Screen co-ordinates are now orientation based in iOS8. Review the session 214 from WWDC 2014 for more info: "View Controller Advancements in iOS 8"
Quote from the presentation:
UIScreen is now interface oriented:
[UIScreen bounds] now interface-oriented
[UIScreen applicationFrame] now interface-oriented
Status bar frame notifications are interface-oriented
Keyboard frame notifications are interface-oriented

Related

How to incorporate a UISearchController into new (iOS8) UISplitviewController

I try to build a simple app based on the UISplitViewController template from Xcode 6 for universal apps (with Storyboard and CoreData/NSFetchedResultsController). This app should also provide a search bar for the MasterViewController. Unfortunately, Xcode 6 provides no InterfaceBuilder element for the UISearchBar/UISearchController combo (only the depreciated UISearchBar/UISearchDisplayController).
In the iOS Developer library, Apple provides the "Table Search with UISearchController" example, but this is not based on the UISplitViewController and supports only iPhone.
My problem is, that I'm not able to show the detail view on the correct ViewController under all circumstances. I tried to transfer the approach from the Apple example project to the UISplitViewController template. In this, one is encouraged to show the search results in a separate UITableViewController subclass (ResultsTableViewController) and use this as the searchResultsController of the UISearchController. I was not able to create a scene in InterfaceBuilder for this setup so I had to add these manually in code.
The problems begin when I click on a table cell of the ResultsTableViewController. This vc is not part of the scene in InterfaceBuilde and I don't know how to add it to the SplitViewController setting correctly. The biggest problem is the weird behavoir of the iPhone 6 Plus and the UISplitViewController. In portrait mode it behaves like an iPhone and doesn't seem to have a SplitViewController and only uses a NavigationController to which I push my DetailViewController. In landscape mode it behaves like an iPad with SplitViewController were I have to get the second ViewController of the SplitViewController childControllers and push the DetailViewController on this one.
Now it happens, when I start in portrait mode and switch to landscape mode that the DetailViewController is all gone, showing gray space where the DetailVC should be. It seems, when going to portrait mode, the DetailViewController gets kicked from the SplitViewController (or the SplitViewController gets kicked at all in favor for the iPhones NavigationController setup). When switching back to landscape the SplitViewController is initialized again but without proper initialization of the DetailViewController.
Is there any template or suggestion on how to correctly implement search capabilities on a universal UISplitViewController?
Cheers
Björn

Xcode 6 - Issue with 4inch screen and iOS 7

I have developed a new app from scratch using Xcode 6.
I have built the app in the "Base" and I set the constraints for all iphones and works perfect.
When I run the app on iPhone 5 or iPhone 5S for iOS 7 I have a black space from the top of the screen but the app is fine for theses devices on iOS8. (I added all the launchimages for all iOS(7+8) and for all sizes.
This is a screenshot with the issue:
The problem was with the constraints of the ImageView. I remove them all and then I set the UIImageView to have equal width and height with the parent UIView. Then I set constraints to keep the UIImageView on the center - both vertically and horizontally.

Xcode 5 — wrong interface on a device with iOS7

My setting for the project:
Deployment target: iOS6.1
Base SDK: 7.0
IB Document: Opens in 5.0
When I run app in simulator(7.0) I see almost what I expect (I don't understand why barbuttons don't use color tint — on previous screen it shows blue):
But if app is running on a device (also 7.0),
Then I see:
As you can see this is some kind of iOS6 UI, but tableview goes under the navbar, which became transparent.
Why does it happen?
Behavior of tintColor for bars has changed on iOS 7.0, please check the image below:
So now to change the tint color for your bar buttons you need to use tintColor which is the color for the interactive elements within a navigation bar including button images and titles.
While barTintColor is the background color of the UINavigationBar.
So basically
For buttons and title:
[[UINavigationBar appearance] setTintColor:[UIColor grayColor]];
For bar tint:
[[UINavigationBar appearance] setBarTintColor:[UIColor lightGrayColor]];
For the tableVIew under the navBar part, set navigationBar.translucent = NO;
I enabled Autolayout in IB, and now it uses iOS7 on a device too.
Upd.: After some time it start show strange design again. It gone only after I set iOS7 as base and deployment SDK.

iPad simulator 6.0 page orientation not working

I recently upgraded xcode to 4.5 which installed iPad 6.0. Now when I run PhoneGap html5 app in it the page inside simulator is not rotating, it was working with earlier version of xcode. When I change simulator from portrait to landscape the html page of app remains in portrait, it does not rotate to landscape with simulator.
This solution worked for me:
Edit AppDelegate.m:
Find:
[self.window addSubview:self.viewController.view];
replace with the following code:
self.window.rootViewController = self.viewController;
If you're still displaying the statusbar then inside:
MainViewController.m:
After
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
add
self.webView.frame = CGRectMake ( 0, 15, self.view.frame.size.width, self.view.frame.size.height-15);
Might not be the best fix, but it worked for me!

EAGLView with CGAffineTransform problem on iOS 4.3

I have a weird problem with OpenGL on iOS 4.3.
I have a ViewController with some views and images in the foreground. In the background I have an EAGLView drawn from a CGImage.
When I try to pinch, pan or rotate the EAGLView (not the OpenGL object, just the view) with CGAffineTransform and GestureRecognizer, the view sometimes starts blinking.
On iOS 4.2 and other older iOS versions it works fine.
Can anybody help me?

Resources