Why my UIScreen mainScreen bounds size return 480 in ios6 - height

Here is my code to get main screen size
[[UIScreen mainScreen] bounds].size;
And in ios5 and ios6 it's return 480 of height,but when I run it in retina 4 inch simulator
,it still return 480 of height.
Anyone know how to solve this problem?
Many thanks.

Just add a new default png photo with 1136 height.
[[UIScreen mainScreen] bounds].size will return new height of 4-inch screen.

You have to add the iPhone 5 Launch image (Default-568h#2x.png) to your project.
The 568 point tall launch image tells iOS to launch your app in 4" mode. If you don't have this image, your app is treated as a 3.5" app. Even if it is 4" compatible.

GO to Target -> General -> Launch Images -> (Select) LaunchImages
Clear your App and Run it.
if you have splash screen select those on Launch Images.

Related

Launch Screen Image size in iOS

I found image sizes are not the same in these websites.
1) https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen/ and
2) https://github.com/phonegap/phonegap/wiki/App-Splash-Screen-Sizes
Nowadays, apple does not use "Splash" screen and they use "launch" screen instead of this.
So, for background image of Login screen, which site should I refer to?
Could anyone help me please?

How to get the exact screensize of an iPhone 6 or 6 Plus

I am using cocoas2d-x V3.0. I tried
Size screenSize = CCDirector::getInstance()->getWinSizeInPixels();
but it returns the size of an iPhone 5 (640 * 1136), while I am testing on iPhone 6 or iPhone 6plus simulator.
You need to get cocos2d-x v3.3 because the previous versions of cocos2d-x do not get the correct screen resolution for iPhone 6 and iPhone 6 plus because they still think that the scale factor is 2 instead of 3 and hence return the iPhone 5 resolution.
This issue has been talked about at this link: https://github.com/cocos2d/cocos2d-x/issues/8545
You need to add Launch images for Iphone 6 & 6+ , only then
it will show you its real screen size.
Go to your Xcode -> Select Target -> Select General ->
select Launch Image Source under App Icons & Launch Images .
Now you can add there your launch images for iphone 6 & plus
which could be 1334*750 & 2208*1242 For landScape mode.
Now you can have your device screenSize with following code .
Size WinSize= Director::getInstance()->getWinSize();
i have faced same thing in my project & this way i solved it.
i am using Xcode 6 & cocos2d-x 3.2
I hope this helps.

Creating Launch Screen.xib for iOS8 ( ... iOS11, Swift 4 and LaunchScreen.storyboard )

I've just found out that in order to be able to have the description for your app in the app store say "This app is optimized for iPhone 6, and iPhone 6 Plus." you need to use a launch XIB or storyboard file for your launch images (per [Apple][1]).
So, I've created a new Launch Screen xib and now I'm a little but since I usually do everything in code and don't use interface builder. I've deleted the default label that is inserted and dropped a UIImageView into the view. Now I'm wondering how would I:
1) Tell the UIImageView to resize to the size of whatever screen it's on
2) Tell the UIImageView to pick ImageA if a 3.5 inch screen is running the app or the ImageB if a 4 inch screen is running the app etc. etc.
Essentially, I'm just trying to get the launch .xib to mimic the behavior of how the launch screen works normally. Would appreciate it if anyone could provide some assistance on this!
You have two options:
You make use of autolayout and give the imageview a fullscreen appearance (distance to top, bottom, left and right equals 0). This would however result in a clipping of the image for certain screen sizes, what you may not want. So you might want to consider (2)
You place the launch screen image into an asset catalog and just put different images into the different size classes.
I found the answer useful.
The old steps in short for creating the LaunchScreen xib for iOS 8 are below the new steps.
With reference to XCode 9, Swift 3 or Swift 4 and LaunchScreen.storyboard following are the new steps.
First step is to create two images for Portrait and landscape mode splash ( png or jpeg ) in your favorite graphic software. ( If your app only support Portrait mode, you may skip Landscape mode image and settings. )
Portrait mode image :-
Create a 'splash-portrait' image with your own full background for size of "width 1125 x height 2436". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 1125 x height 1471". This should always be in center of above full image.
Landscape mode image :-
Create a 'splash-landscape' image with your own full background for size of "width 2436 x height 1125". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 860 x height 1125". This should always be in center of above full image.
Once both the images are ready, you may add it to xcassets or keep in resource.
Now go for the following steps.
1) "LaunchScreen storyboard" is already created with the new project. Open it.
2) Add an Image View on the view.
3) Set the above saved 'splash-portrait' image to image view source.
4) Set Image view 'Content mode' of Image as "Aspect Fill".
5) Add 4 constraints of Image View for Top, Bottom, Trailing and Leading to Superview.
This is done for the portrait mode app splash.
For landscape mode support, do the following extra steps. ( you may refer full answer by #Sakiboy at
https://stackoverflow.com/a/46089856/2641380 )
6) Click the + button next to the Image view source that you set up in step 3.
7) From the pop-up that is now displayed select Regular for both the Width and Height selectors. This is specifying a new adaptive set for iPads that are in landscape. A new image source field will appear with the title wR hR. Add the 'splash-landscape' image to the wR hR Image source field so the storyboard knows to use a different image when in landscape.
8) Now we need to add support for the 'iphone plus' devices when in landscape. So click the + button next to the Image source field again.
9) This time select compact for the height and regular for the width selectors. This is specifying a new adaptive set for “iPhone plus” devices that are in landscape. A new image source field will appear with the title wR hC.
10) Add the “splash-landscape” image to the wR hC Image source field so the storyboard knows to use a different image when in landscape on an “iPhone plus device”.
As iPad devices are "Regular for both the Width and Height", We will see 'splash-landscape' image in iPad for both portrait and landscape mode. Width 860 for displayable content in 'splash-landscape' image will show full content in both portrait and landscape mode.
The old steps in short for creating the LaunchScreen xib for iOS 8.
1) create a new "LaunchScreen xib" from new file --> user interface --> launch screen ( keep auto layout ON ).
2) Add an image view in the xib --> view (main view).
3) set splash image to it ( the image should not be in assets file ).
4) set image as "Aspect Fit" ( if required ).
5) you may also change the "view" (super view) background color as close to background color of image.
6) select the image view, click from menu - editor - pin - bottom space to super view.
7) this will show red error mark near "view" ( super view of image view ).
8) click on the error mark, you will see approximate two auto layout errors.
9) on clicking on the error you will find menu with auto fix the layout errors.
10) on fixing the errors, you will find total four "Constraints" with "vertical" and "horizontal" space between superview and image.
11) now you may test them in different devices or simulators.
Regards.
You can resize the image by setting constraint to the top, bottom, leading and trailing edges of the superview. Just click the imageview and select Editor->Pin the top context menu. You can also set the aspects of the UIImageView by clicking it and setting it to for instance "Aspect Fit". Make sure the ImageView covers the whole screen before setting the constraints, or else you would have to modify the contstraints.
To set different images for different screen sizes, I would guess you have to create a class and modify to the viewWillAppear method to load an appropriate image
Good luck!
Erik
Create a new file. Under User Interface select View. After, you can name your xib LaunchScreen and you can test it out by adding a label with something like “Test Launch” and run the app. You should see the launch screen appear!
The Launch xib can't have a customized class since your app didn't launch when it is displayed.
What I ended up doing is:
use sizing class feature
Create 3 UI images (one per sizing class)
Use auto layout with constrains which apply to each sizing class
So when you display one type of device the width and hight constrains of the other two UIImageView are set to 0

A strange frame rate with actions on retina iPad only

Using actions with cocos2d v2.0 it works perfect on all iPhones and regular iPad. but when testing the same code only on iPad retina simulator ,when the button is a x2 bigger, so all actions (scale,move etc) are seems like they missing some pixels in their movement( for example a moving sprite is go 1 -3 -5 instead of 1-2-3-4-5 , seems like low frame rate or jump pixels)
There is no memory issue, its just a simple page with simple action :
id action=[CCScaleTo actionWithDuration:0.5 scaleX:0.95 scaleY:1.1];
id action1=[CCScaleTo actionWithDuration:0.5 scaleX:1 scaleY:1 ];
id seqb=[CCSequence actions:action,action1, nil];
id forever=[CCRepeatForever actionWithAction:seqb];
[play runAction:forever];
Why is it happens only in the retina display? does actions are not have the resolution for iPad retina -so they jumping on pixels ?
Do i have to enable the retina somewhere ? (it does get the -ipadhd image as retina and resize it)
EDIT EDIT
I have read that :
Slows down the iPad retina simulator 6.0
and could see that maybe the mac processor is not handle that .
Well thats strange , i have the new macbook retina ,it has a strong processor, and i am sure more than an iPad, so how is that true that iPad can handle it but not the mac ?
ignore the simulator, test on an actual device.
Note that the ipad retina simulator is really slow which is likely causing this issue.

Cocos2d-Things appear bigger in simulator

I've recently noticed that things accommodate differently on the simulator and a real device when using Cocos2d.To make sure I did the following:
1. I created a blank Cocos2d project. In the init method I created 7 sprites from Icon-72.png(which is found in the resources folder of the Cocos2d template) and added them to the screen.In the simulator only 6.5 sprites could accommodate side-by-side whereas in the iPod touch all seven sprites could accommodate easily and almost half of the screen width remained unused.
2.Then I created a project from Single View Application template. I added the same Icon-72.png to the project. Then on the storyboard I added 6 image views and set their image property to Icon-72.png. This time I had exactly the same result with both simulator and the device.
I guess there should be some tweak as to how to fix this issue with Cocos2d because it's not Apple's fault. Do you know how to handle this?
The iPod Touch could have the retina display and the simulator wont have have it. If you need the same display as of the iPod Touch You can use the iPhone Simulator with the Retina Display and you would get the same screen. Another Option you can use is Copy and paste the Same file with -hd prefix ex:(Icon-72-hd.png) with 72x72 size and you can get the same result.
There is no problem with either the version of cocos2d or with the Apple for the issue you are facing.
I guess I do have poor explanation but you would understand my explanation.
The iPod Touch will be a retina display. Cocos2d doesn't automatically double the size of images.