How do I get my iPhone-only app to run on iPads? (constraint question?) - objective-c

My iPhone-only Objective-C app (iPad not checked) runs correctly on SE 2nd up to iPhone 12 Pro Max, properly centered, fully functional, but is stretched and clipped on any iPad (in Simulator--I blanked center content below re privacy), and on some I get black screens. Every element is constrained ultimately centered on Superview X and Y centers (nothing absolute); is that the problem? Is there a typical problem that keeps iPhone-only apps from appearing properly on iPads? The app in no way does anything special for iPads. Is there a good tutorial about this subject? Thanks

The answer is simply that constraints sufficient for all iPhones are not necessarily sufficient for iPhone in iPad. Just because the app is sized correctly for all iPhones doesn't mean it's correct for iPhone in iPad. That's what this newbie learned!

Related

Objects not show when change iPhone size storyboard to universal in Xcode 7 iOS Objective C

I have iPhone app and storyboard is done.
and every view in story board has iPhone size.
Now i tried to set any any size for views but it has problem.
when change size to iPad (any any) , all of objects in views will disappear and then running app , not showing anything in iPad view.
I don't wanna using another storyboard.
Target Device is Universal and i am using Objective C.
Thank you
Help me.
Update:
Resolve the issue with cells not appearing on iPad, needed to add the UICollectionViewDelegateFlowLayout methods for iPad.
Original:
If you get the size classes to regular width and height (iPad size classes), then set the constraints for your objects, I assume they are a width and height of 0, that's why you can't see them.
I think it's better to build constraints for (any, any) and then create specifically for iPhone or iPad if necessary, if you are creating a universal app.
Let if know if you encounter problems, hope this helps, good luck.

iOS Universal Image Assets

For a new project my client wants to cover all iPhone and iPad sizes. For icons and sprites I'm not really gonna change the shapes of the images, but I'm in a bind with assets for my background images.
Looking at http://iosres.com I was wondering if there is some logic to cover both Landscape and Portrait 3:4 and 9:16 in one asset or should I simply make a set of iPhone and iPad and use UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad to figure out what to show before loading my views?
Also I'm wondering what's most effective for all the different device sizes. I know from experience that an iPad 3 wouldn't like to have a background image loaded on 4k resolution and that you want to avoid pixel differences so it won't trigger scaling in UIImageViews. Will iOS automatically figure out that the iPad 3 will use like the #1x variations, whereas the iPad Pro will load the #3x versions?
Yes iOS will automatically figure out which image to load at runtime and load #1x #2x or #3x depending upon the type of device. You don't need to do anything like UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad for each image.
Edit:
You can also add ~ipad suffix in image names so iOS will pick the appropriate background image for iPhones and iPads. i.e. image_name#2x~ipad.png and image_name#2x.png.

Size Class Design for Iphone and Ipad

I have to support both Landscape and Potrait for Iphone and Landscape for Ipad respectively, Under Size classes is it a necessary that i have to start with AnyAny first for basic layout and then proceed with compactwidth & RegularHeight for support Potrait orientation for Iphone
It doesn't really matter as for each size class you can set installed (as if, active constraint that will be fulfilled) constraints and which will be uninstalled ( disabled ). Just make sure that you don't have overlapping constraints and you are good to go. For more reference there is a great article: http://www.raywenderlich.com/50319/beginning-auto-layout-tutorial-in-ios-7-part-2
Also they have a book about iOS 8 and there you can find even more information.

SKSpriteNodes are showing up different sizes on a real iPhone

I am making an app, and recently, out of the blue there has been a problem.
When I ran my app on my iPhone, (which I have been doing fine for the last few weeks) the images show up at completely different sizes.
For example:
The start button on the Xcode simulator is xScale 2.0f. On the iPhone it shows to be roughly half that size. I keep all the images in a .atlas file, and they are all .png. I am using sprite kit as well, and the iPhone I am using is on iOS 7.
Here is what I'm getting:
Unwanted result (As is on iPhone)
Here is what I would like:
Desired Result (As is on simulator)
This has also happened throughout the app, with other sprite nodes. Does anyone know how I can fix this problem? Thank you in advance, and I would have posted screenshots if it wasn't for the 10 rep limit.
Edit:
I have now got most of the images working, by creating a #2x version of all the images.
But there is still one graphic that is this time TOO LARGE on the iPhone. Thank you for all your help so far, does anyone know how I can make that one image smaller on the iPhone?
Your PNGs need to be labeled with a 2x or 3x. This is Apples way of accounting for the retina screens.
"ImageFileName#2x.png"
for Iphone 4,5,6
"ImageFileName#3x.png"
for Iphone 6 Plus
If you have no extension, Apple will assume it should make your image 2 or 3 times bigger to account for the extra pixels in the retina displays. If you add the #2x or #3x, Apple assumes you provided the image already accounting for the retina pixel count.

Cocos2d - 4inch screen displace the game

i developed a game for the iphone4. Now i got problems with the iphone5 and the 4inch screen. My game is on the left side of the 4inch screen and i have a big black border on the right side. But the buttons from the game are in the middle of screen, they have same position like on the iphone4. I checked everythin but i dont know why the background-images and the sprites are on the left side and the buttons are in the middle. I want that everything is in the middle or on the left side. It would be great if anybody could help me!! Thanks!!
COCOS2d-iPhone:
If you're using the latest beta, the only change you should need to
make is export all your images at twice the size and use the "-hd"
suffix, similar to Apple's "#2x". The documentation also says you need
to set the content scale factor of the director.
You can find the documentation here.
and more detail here.
COCS2d-X:
Cocos2D-x has a very easy solution for multi-resolution problem.
In fact you just need to set your DesignResolution and then just imagine your target device will has this resolution.
If target device really has this resolution ( or some other but with same ratio) cocos2d will handle to fix screen and your game looks same in all devices.
And when ratio of target device is different, you have many option ( as cocos2d language, policy) to manage that.
For example if you use Exact fit policy, cocos2d will force your game ( and design) to fit target device screen (without that black boarder).
Exact fit
The entire application is visible in the specified area without trying
to preserve the original aspect ratio. Distortion can occur, and the
application may appear stretched or compressed.
For more detail just take a look at this link : http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support