Iphone to Ipad porting-only top left usable - iphone

So I'm trying to port an existing iphone application to the ipad. When I run the targeted device set to ipad, only the top left corner of the screen is usable, (the size of the iphone). However, all table cells, objects and buttons exted out to the width of the ipad. But that area is not responsive. What am I doing wrong?
I also tried autoresizing some of the views, and even doing "upgrade current target for ipad," and selecting "two devices," though I don't know what it does. Upgrading it adds a new target, but doesn't change anything

Never mind, it's because we didn't enable full screen.

Related

Storyboard view designed properly with Auto Layout and Trait Variations in Interface Builder of Xcode 8 has wrong size in Simulator and Device

I've been working on iOS apps for many years before a longer pause. On my new project I decided to try the new features of the Interface Builder and Storyboards (Swift 3, Xcode 8.2.1). So I've got a working app with precisely defined constraints for all supported devices, following the "regular" and "compact" width/height paradigm. Everything seemed to work and I loved the approach.
I was finalising the first views (and their controllers) for the iPad simulator before I decided to run the app also on an iPhone simulator to check for the layout. It turns out that all works as expected but for ONE view.
This view has the following behaviour:
If in the Storyboard canvas (and even the Assistance Editor, which
looks the same for me, by the way) I selected "view as iPad 9,7" and
run the iPad simulator (of the same screen size), the layout works the way it should.
If in the Storyboard canvas I selected "view as iPhone 5" and
run the iPhone 5 simulator, the layout works the way it should.
If however I select "view as iPhone 5" and run the app on the iPad simulator OR any other false combination, the following happens:
Once the view appears (custom segue, or default push. All the views are inside a navigation controller) it shows the content scaled down/up to the size of the preview size I selected on the Storyboard. Then it animates (scaling from the top left corner) to fill the screen. For instance: If I select "view as iPhone 5" and run on an iPad, the view appears in the left top corner of the iPad simulator having the size of an iPhone 5. Then it scales up to fill the screen having the exact layout I want.
One should add that inside this one view, the layout for all devices looks the same, merely scaled down/up. So it really just comes down to wrong view size.
This all happens ONLY to one of my views, which I all have designed and laid out (constraints) the same way. This happens EVERY TIME, and it happens on the simulator and on real devices.
I was trying various suggestions from the web for the last week and I failed to find any topic (on Stack Overflow) that was able to help me.
I'm lost. I'm glad for any suggestions!
Thank you.
After removing everything from my view step by step and building every single step I found that I had a self.view.layoutIfNeeded() inside my viewDidLoad() which was inside an animation block animating a single subview, but for some reason lead to aforementioned issues. Removing it solved the issue.

View doesn't take up full screen on iPad

Simply that. I'm working on an iPhone (iOS) game that loads without using .xib files. Window and view is created programmatically. It automatically detects resolution and retina display and adjusts accordingly.
However when run on and iPad (only have the simulator for iPad), it shows up in a mini window that same size as the iPhone resolution, with a little 2x button in the bottom-right corner. I want it to load fullscreen with full resolution (larger res than the phone). Everything will scale accordingly so it would look the same as on the phone, and look just as crisp.
Why does this happen? Why doesn't the window automatically take up the fullscreen like it does on iPhone?
After much searching, I've found this template: https://github.com/ryanscott/rcloudlib/blob/master/Samples/clean_universal_app_template.zip
which loads properly for me on both iPhone and iPad.
Looking at the code, however, it does nothing differant than what I am doing. All it does is check which device is being used, and loads the appropriate app delegate, which in this case contain the exact same code, albeit for background color. This is clearly aimed towards those who want to have a different view load on iPhone vs. iPad, while avoiding using nibs. I want the SAME view across all devices, so I have no need to use multiple delegates or the like.
How can I force the app delegate to use the fullscreen regardless of device?
In your Xcode project file, find your target, go to the Summary tab and make sure that Devices is set to Universal under iOS Application Target
Yup! In Xcode 6 the "Devices" option is now called "Deployment Target" and is located here:

How do I provide iPad and iPhone 5 versions if I use .xib files?

I have a very simple app that just displays a block of text every time you touch the screen. I have a graphic behind the text, that the basics of it.
I made it back in 2010 using a .xib file to create the text field and the image.
I'm now attempting to make it fit both iPhone 5 and both iPad and iPad Retina.
I can't simply stretch out the existing .xib layout because it just accepts and renders the last one I do. (If I stretch to iPhone 5 resolution it goes off the screen on an iPhone 4S).
Is there anyway to reference different .xib files based on the iOS device?
Thank You.
According to the documentation, you can use:
myNibName~ipad.xib and
myNibName~iphone.xib
and the correct xib will be loaded depending on the device.
You can read iOS Supports Device-Specific Resources.
EDIT:
how do you distinguish between iPhone 3.5" vs iPhone 4.0"
there is no device modifier specific to the iPhone 4". You will have to define your nib in a way that it can "stretch" vertically.
The only mechanism is a iPhone 4" specific Default-586#2x.png file. If you provide it, then the whole screen area will be available to your app.
If you do not provide it, then the app will run in a special mode whereby its content is presented in a 3.5" area. The remaining area is filled with a top and a bottom black band.
iPad vs iPad Retina?
nothing special here, since the 2 devices share the same "logical" resolution of 768x1024 pixels. As usual, you can use #2x modifier to supply specific retina-resolution images; and, if you need it, you can use ~ipad#2x modifier to supply retina iPad-only images.
E.g.:
iconImage.png -> non-retina iPhone version
iconImage#2x.png -> retina iPhone version (also retina iPad version if no ~iPad is given)
iconImage~iPad.png -> non-retina iPad version
iconImage~iPad#2x.png -> retina iPad version
EDIT:
To make your UI stretch, go to the metrics pane in IB and set the vertical spring for the view height (this is the inner vertical double arrow in the picture below).
You will have to find your way through this a bit, especially if you have a lot of subviews.

iPhone game display is off the screen by 10 pixels or so on the device

I recently deployed my first iPhone app, a simple game, to my testing iPhone for the first time. Everything looks and runs fine on the simulator in Xcode, but on the iPhone the whole image is shifted up about 10 pixels or so. So the gameplay goes slightly offscreen on top and has a slim white/grey bar at the bottom. Has anyone encountered this before? I do have the status bar display turned off, I'm wondering if the device handles that flag differently than the simulator. I also have the rotation hardcoded to be in portraitRight mode at all times, and I have an extra line in the code to make the simulator do that automatically that's apparently not necessary on the device.
Everything is very simple, so I'm not sure where this glitch is coming from or even where to look.
Did you use Interface Builder to create your UI? If you did, then go and check each and every XIB file(s) objects' Size & Position as well as Autosizing in Size Inspector (command-3).
It's very important to check both: your coordinates might have gone wrong after some change you did and autoscaling works in weird ways unless you attach to correct edges. Apple documentation should help http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html

iPad UI clipped in simulator

My views created for iPad form factor look fine in Interface Builder. However, when I debug my app in iPhone Simulator 3.2 (with Hardware -> Device set to iPad), I see the UI clipped and about half size. There is a 2x button at the bottom which lets me zoom in. But this just shows the same clipped UI in double size.
This is really weird since I have created the XIB for iPad form factor and it is supposed to fit iPad completely. Any ideas what I might be doing wrong?
I am using iPhone SDK 3.2 downloaded on 4/30/2010.
Thanks.
-Raj
It sounds like you've accidentally created an iphone project, rather than an ipad project. In the "New Project Dialog", make sure you select iPad from the "Product" dropdown in the middle of the dialog:
alt text http://www.freeimagehosting.net/uploads/7f49d44254.png