xcode view size smaller than iphone - objective-c

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.

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.

Why does iPad preview use wrong image?

My question is, why does the iPad preview use a different image than the storyboard for wRegular hAny?
I'm trying to set up a universal app with a menu that will use larger buttons for iPad. In the asset catalog, I've specified the standard image size for wAny x hAny, and loaded a larger image for wRegular x hAny.
The story board looks fine for all size classes, with the wRegular x hAny using the iPad image, and everything else using the iPhone image. But the previews all use the iPhone image, including the iPad preview, despite the storyboards showing the correct images. In the screen shots below, the story board is shown to the left, preview to the right.
Can someone tell me what I'm doing wrong here? I'm trying to avoid using explicit image sizes for each class - is that what I should be doing?
Any help would be greatly appreciated. I've read everything I can on using different image sizes, and still cannot figure this out.
enter code here
You can't have a different images by size class for the same button in Interface Builder. It looks to me like you set the image of the button to be the iPad one first in Regular/Any, then set the iPhone one afterward in Any/Any which changed what you did in Regular/Any.
In this image, see how the Font has a + symbol to the left of it, but Image doesn't? That's for specifying the value per size class. Since Image doesn't have that, it's not a value saved for the specific size class.

iOS UI Custom button images

I'm developing a iOS app that is using custom UIButtons with round shape. I wanted to add Image to these buttons and would like to know if I use IB to select an image from my project, do I have to also worry about 2x retina images for retina display?. What should be the image size for both non-retina and retina devices (all iPhones (including iphone 5) and iPad including mini) when I embedded them from IB?
Is there a best resource available on the Internet to get these pngs files for buttons?
Yes you should use all the images. you should just add the images with proper names to the resources folder. And just select the non-retina image rest the compiler will take care of.
http://www.idev101.com/code/User_Interface/sizes.html
The above link will help you with the images sizes
It is easy. Goto interface builder and on the right hand panel you will see this -
All you need to do is first configure your button as custom then include a image file in your project through xcode and then you can select that image in the dropdown in background or image property.
Note that all this is possible to do through code also, its just that IB makes it interactive. Hope this helps.

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

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

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