iOS App won't use 4 inch size even with default-568h#2x image - objective-c

Everything I read (including on Stack) keeps saying that in order to have an app use the entire 4" iPhone screen you simply have to add a default-568h#2x.png image with a resolution of 1136 x 640.
I've added this image and when I run on a 4" iPhone simulator everything (including the launch image) renders windowed with the black bars at the top and bottom. I've tried deleting and re-adding the image, made sure it shows up as the 4" launch image in the Target summary tab, and adjusted all of the simulated metrics sizes in my storyboard to be Retina 4 full screen. Even with all of this, I'm still getting the old 3.5" window.
Is there something I'm missing or doing wrong?

You spelled Default-568h#2x.png wrong. Remember that iOS is a case sensitive file system, so the capital "D" matters. (I had a very similar problem -- which is what led me to this question -- because I was missing the "h" )

I'm not certain on what the issue is but a couple more checks you could do would be to make sure you have built the latest version of your project before simulation. The simulator may be launching a previous build that did not have the 4# images
Maybe try temporarily removing your smaller resolution images to see if that makes a difference.
Also make sure when the simulator is open that you have the correct hardware configuration in the hardware tab

Related

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

xcode view size smaller than iphone

That never happened before iOS 6.
Now, I create an "auto layout", and I realized that the size was different in xcode, because the image was large but was correct in photoshop. When creating the app in the simulator, I have this:
I kept finding weird. So checked the size of the iPhone 5 and moved, as I always did, then looked like this:
When creating the app in the simulator, looked like this:
I wonder what happened with Xcode? Someone went through this already?
Thank you
It looks like you are working with an XIB that was identified as for iPad. In the Attribute Inspector, what options are you given under size? An iPad XIB has these options in Attribute Inspector - Size:
If that is what you see, you may have to create a new XIB, and be sure to choose Device Family - iPhone.

Designing at 1024 x 768 resolution

I have a windows 8 app. The app consists of image buttons which are sort of distorted when I run them in a simulator with "1024 x 768" resolution.
The point being, I am not able to specifically design for that resolution, because my visual studio won't allow me to design at that resolution.
Looking at the picture will clear my exact description of the problem.
I am looking for the resolution 1024 x 768 in the drop down menu, but I can't find any.
AFAIR 1024*768 isn't a valid physical size. You should find it in the "there's something else snapped to the side" category (the second icon to the right of "View" and above "FullScreenLandscape").
Look at the top of your image. Do you see the view selector? The Visual State is Fullscreen. Change that to the fill view (the 3/4 view) and you should see the 1024x768 view.
For further reference regarding Metro screen sizes, read: this blogpost from Microsoft.
Edited 10/13
I see this on the simulator for my app even not in snapped view:
What version on VS are you running? I am running Version 11.0.50727.1 RTMREL with .NET c4.5.50709

How do I stop Cocos2D from requiring standard definition resources (SD images)?

I am developing an iPhone game with Cocos2d-iphone.
I want my game to only be available to the iPhone 4 AND iPad. Retina enabled for iPhone 4. I don't want the game to run on older devices.
Cocos2d will always ask me for -hd and non-hd files. If I don't provide the SD files, I get errors. I don't want that: is there a way to disable Cocos2d from trying to retrieve SD files, and only get -hd suffixed files by default?
Oh, and when the game is run by an iPad, the graphics will be the -hd ones as well. So the point is, I only want to have -hd files in my project.
What are the proper steps to edit Cocos2d's source for such?
If you are using cocos2d version >= 2.0, then you can change the value of a global variable found in CCFileUtils.h:
static NSString *__suffixiPad =#"-hd";
(Its default value is #"-ipad".)
If you are using cocos2d version < 2.0, then you can find here a category that I wrote to be able to transparently use -hd images created for the iPhone 4 on the iPad 1/2.
Actually, it does more than that, but if you add it to your project, then "-hd" images will be "automagically" used on the iPad 1/2 instead of their SD versions (which you could also not include in your project).
Let me know if you have any issues integrating this code.
If I would have been at your place.. I would have played with a trick.. Don't down vote the answer if you don't like.. But Its just a thing in my mind.
Use -hd images in the code directly.. iPhone 4 will handle it easily.. Older iPhones will show it much larger and it doesn't matter as you are not supporting them...
So instead of using Background.png , directly use Background-hd.png as it will work fine for iPhone 4.. Instead of wasting time on all these SD stuff.. I will directly use my -hd images for my work...
I can not say about new iPad.. But old iPad can easily use -hd images in code as you want.. For iPad I have directly used in my code earlier..
Hope this helps.. :)
This tutorial might help.
If you only provide -hd assets, you should only get errors regarding missing SD assets when running on iPad. The iPad doesn't have a Retina display, but it certainly is high resolution enough to be treated like one.
Since cocos2d passes all filename requests through the fullPathFromRelativePath function in CCFileUtils it may be enough to modify this function to treat the iPad like an HD device and force it to load -hd assets on iPad.
the 1st idea i can think of is to use #2x suffix for images (UIKit style) and you wont need to enable retina display in app.The problem is that on the ipad you'll have to write your own method to remove #2x suffix
the 2nd idea was to make a SD image..but only 1x1 pixels... it takes virtually no space at all ( 119 bytes with white pixel). Should work on ipad as-is
3rd idea:don't enable (or enable..doesn't make any difference) retina display but have the HD images as SD images.I've tested this on cocos2d v1.0.1 and it seems to work.Also..it should work on ipad
4th idea forcefully enable retina display in ccConfig.h (so that director won't ask you for the SD images on ipad) .I'm not sure about this one because there are quite a few tests that check for resolution, device and if it's retina and you'd have to edit all of them
these are just ideas off the top of my head..they may be wrong..but they're just ideas