16

I have added Default-568h@2x.png to my project and set it in project settings, I have also set autoresizing options for my view and elements on that view which is initially loading on my application which is landscape-only, but after running my application in iOS 6.0 Simulator Retina 4 inch I see my application moved all the way left, leaving black pixel area on the right.

Any idea what should I do beside these things in order to see my application runs in "full screen" on iOS 6.0 Simulator Retina 4 inch?


[edit #1: AppDelegate]

I also edited my AppDelegate.m like this:

viewControllerMain = [[ViewControllerMain alloc] init];
//[window addSubview:viewControllerMain.view];
window.rootViewController = viewControllerMain;

[edit #2: Editing frame]

I managed to achieve full screen mode, but it's not working as it should. I do this in my views:

CGRect frame = CGRectMake([UIScreen mainScreen].bounds.origin.x, [UIScreen mainScreen].bounds.origin.y, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
self.frame = frame;

This only brings my view to full screen, but black area on the right I mentioned on the beginning is dead and no user interaction is possible in that area (I have UIButton there which doesn't react on touch). So basically, what I did only made my view appear in full resolution, but functionality of elements on view is limited to area where my app originally showed when I first started it on Retina 4 inch simulator.


[edit #3: Changing size of UIView's in XIB files]

I even tried to change actual size of UIView's in my XIB files resizing them all to Regina 4 Full Screen, but still - same thing.


[edit #4: Changing size of window object]

I have tried to change size of window object in AppDelegate.m but again no luck. Here's how AppDelegate.m look like.

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

mainViewController = [[MainViewController alloc] init];
window.rootViewController = mainViewController;

// Override point for customization after application launch
[window setFrame:[UIScreen mainScreen].bounds];
[window makeKeyAndVisible];

[edit #5: "Solution"]

So far I did following: In IB I made new UIViews with iPhone 5 resolution size, assigned same owner classes which are handling their equivalent UIViews made for pre iPhone 5 resolution and in code where do I need to load some of these UIViews I check [UIScreen mainScreen].borders to determine which device is currently running my application. In this way, I managed to get things work.

But still, main question remained - why didn't all my UIViews automatically stretched to new resolution after I did all those things I mentioned?

Anyhow, bounty remains active for 5 or 6 days. If someone manages to solve this issue, I'd be very grateful. If not, I'll give bounty to @onegray, since that was the thing I didn't took care of at first place, and in my current implementation it is really important.

Best regards.


[edit #6: MainWindow.xib Full Screen at Launch option]

As @user1702985 suggested, I turned this option ON as it was deselected. But no luck.

When I start my application I show one View for 2 seconds with one UIImageView on it. If I set Autosize properties right, this UIView is shown in fullscreen on iPhone 5 simulator. BUT. After that I have second UIView which contains vertical UIScrollView, UIViews as header and footer and one UIButton, and I also set all autosize options for these elements, but this UIView is shown in iPhone 4-- resolution. It really acts strange and I still don't know what can it be.


[edit #7: Auto-resizing options which are set]

This auto-resizing option is set for all my UIViews and it's elements.

enter image description here


[edit #8: Explanation of Full Screen at Launch option]

MainWindow.xib properties.

enter image description here

uerceg
  • 4,637
  • 6
  • 45
  • 63

11 Answers11

21

I hope this will help you but not sure that you will got touch effect in full screen, So you have to check for full touch for your application.

Step 1: Click On Project from Navigation shown in image and click on missing file

Step 2: In second image click on Add

Now run project your project will run in Full iPhone 5 screen or simulator.!

enter image description here

Ashvin
  • 8,227
  • 3
  • 36
  • 53
9

Make sure that key window has proper size. Workaround is to set proper frame: [window setFrame:[[UIScreen mainScreen] bounds]].

Update:
It is difficult to guess where is the problem without having the source code. I've created simple app stub to test interface orientation for iPhone4/iPhone5. I just created new "Single View Application", added some subviews to the root view, and added "Defaults" images. I did it in Xcode 4.3.2 without any extra features of Xcode 4.5. And app automatically stretches its screen to proper size (for both portrait/landscape orientations).

Community
  • 1
  • 1
onegray
  • 5,105
  • 1
  • 23
  • 29
  • Thank you for your advice. Please take a look at edit #4. I did what you told me to, and indeed when ever later I check window borders I get 320x568, but my UIView which I made in XIB file is shown in landscape mode so that on the right I have black area of pixels and UIView is shown in iPhone 4 resolution (320x480). – uerceg Sep 24 '12 at 08:23
  • Thanks for update, too. I tried and yes, it works flawlessly. I did the same thing, tested it and worked like a charm. Removing-Adding Default-568h@2x.png disables-enables support for iPhone 5 resolution in this project, but I really don't know what's so different in mine application that practically NOTHING helps. I have application which contains MainWindow.xib but I set in there also Full Screen at Launch, but nothing changed. – uerceg Sep 28 '12 at 05:46
  • I don't know code for that option, but there's option to check for MainWindow.xib UIWindow in IB. Check edit #8 for explanation. – uerceg Sep 28 '12 at 08:02
5

I had the same issue of part of the screen not responding to user interaction. Selecting the "Full Screen at launch" option on the MainWindow.xib fixed it for me.

  • I totally forgot about this option, it wasn't checked for my case. But it still doesn't fix my problem. Check my edit #6. Thanks for the answer though! – uerceg Sep 27 '12 at 11:50
4

No matter what I did, I could not get my app fullscreen.

But after I added a file "Default-568@2x.png to my app. Now all the xib's run full screen. You can quickly test this by making a new app in XCode and copying the the black png that was created.

John Ballinger
  • 7,380
  • 5
  • 41
  • 51
  • Thanks for the answer. I did the same thing. My application in start didn't work in full screen, and then I added "Default-568@2x.png" and it also didn't work. :) I did testing with this method of adding this png with some simple applications I wrote in XCode 4.3.3 and targeted for iOS 5. For those apps, it worked like charm. But for this application which was originally written for iOS 4 and in earlier version of XCode - that thing does not work and I don't know why. – uerceg Sep 26 '12 at 05:01
  • Also an amazing tip, that did work for me in some cases. Thanks. – Fattie Dec 07 '13 at 12:21
2

If you use XCode 6.1 try this solution (for projects without full image set):

  1. Project -> Target -> General -> App Icons and Launch Images -> Launch Screen file
  2. Choose xib for first screen.
Vlad
  • 3,465
  • 1
  • 31
  • 24
1

did you try this?

iOS Simulator > Hardware > Device > iPhone(Retina 4-inch)

i just run into the same problem and this is how i solved.

Raptor
  • 53,206
  • 45
  • 230
  • 366
0

How are you adding the main viewController to the window? Just adding the view as a subview isn't supported any more in iOS6.

Here's an except from an article on my blog about making apps work on the iPhone 5 screen size.

Use window.rootViewController to add your initial view

First up, if you're building your initial views in code make sure you add your initial view to the window with window.rootViewController rather than the old way of simply adding the view as a subview. If you don't do this, autorotating will not work at all for your app under iOS 6.

Here's an example:

navigationController = [[UINavigationController alloc] initWithRootViewController: myRootVC];
//[window addSubview:[navigationController view]]; Don't do this!
window.rootViewController = navigationController; // Do this instead!

More at http://pervasivecode.blogspot.co.uk/2012/09/making-apps-work-on-iphone-5-screen-size.html

Ben Clayton
  • 80,996
  • 26
  • 120
  • 129
  • Sorry for not mentioning that. I made #edit 1 to give you an answer to your question. I commented 2nd line and added 3rd from edit #1. – uerceg Sep 20 '12 at 08:52
0

Delete App on simulator by LongPress-ing and re-run.

This works for me, after 4 inch retina adjustments. Everything was auto-resized the way I stitch-up in IB.

dklt
  • 1,703
  • 1
  • 12
  • 12
  • Thanks for the answer. I did that dozens of times. I delete it from Simulator, I even delete it directly from the disk where Simulator stores application files, I tried deleting derived data from Organizer also, but no luck. My first screen on startup which contains only one UIImageView is stretched to full screen, but second screen which contains UIScrollView, UIViews for header and footer, some UIButton and UIWebView on it doesn't get stretched. And I performed same autosizing method for elements on both UIViews. – uerceg Sep 28 '12 at 05:35
  • did you stitch-up the subviews and set their auto-resizing mask accordingly? – dklt Sep 28 '12 at 06:23
  • I have set auto-resizing mask of each view and element to UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight. Check edit #7 to check if I did it properly. I did everything from IB regarding to auto-resizing. Since I am not so experienced in iOS development, can you explain me what do you refer under "stitch-up the subviews"? Thanks. – uerceg Sep 28 '12 at 06:31
0

Please add launch screen for application.

Chathurka
  • 605
  • 6
  • 11
0

We ran into a similar issue on an app that was created back in the iOS 6 days when testing on iOS 8.

The fix for us was setting the "Hidden" flag on MainWindow.xib.

This is how we found out about the fix here.

Community
  • 1
  • 1
diadyne
  • 4,038
  • 36
  • 28
0

The same was happening to me. I was trying to make a video splash screen, and since I can't control the time the splash screen is shown, and was therefore unable to show the full video, I had to make a fake splash screen, which was just a controller that was shown first and then removed. That controller's view was not being shown as fullscreen no matter what I tried. In the end, I found out it was happening because I had no splash image.

Solution: Add splash screens to your project (even if they are just black images), and the full screen problem should be fixed.

tsilva
  • 21
  • 2