Anormal layout settings at iOS Simulator run time - ios

Well, my problem it´s not code related. Almost all visual iOS Applications that i make at xCode got distortions at run time, for example I put a text input at the very center of the Mainboard and the simulator puts it way below than that at execution time. I would attached an image of an example regarding the problem, but I don´t have the reputation. What could the problem be? I´ve already uncheked NSLayout settings

You are creating your views for 4 inch screen and then run Simulator for 3,5 inch screen. No surprise that your positions are different. You should use Autolayout + constraints or UIView:autoresizingMask property to make your GUI change automaticaly for different screens.
Start with this article http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1

Related

App not displaying properly on iphone6

I am having an issue with running my project on the device. Here are two pictures. The first one shows what the project looks like when I run it on the simulator. The second one is the same project run on the device:
As you can see in the first screenshot, I am using Auto Layout and Size classes. On the attributes Inspector I have the size set to iPhone 4.7-inch, but if I set to to "inferred" the same thing happens. I have done a fair bit of research on the web to see if I can find the solution but to no avail. I am fairly new so it could be something simple. Any help appreciated.
Update: I have set the size to inferred and turned off size classes and auto layout and I had resize all the buttons from 100 pixels to 80 pixels and now it looks fine on the device but I get the opposite problem on the simulator which was fine then. Is this an issue to do with iPhone 6 plus?
See next screenshot. On the left the storyboard and on the right the simulator.
Have you set attribute for it..? Because you are using size class.
Check it. If not set then set it for all objects.

Auto Layout issue in XCode

So I've been working on an XCode Project for a while, it's practically done but there's a problem I didn't realize until it was too late. I'm working without Size Classes but with Auto Layout. I have a background image in the back and some buttons and labels over it. When I was setting the constraints for everything it all seemed to be in its place and I tested it various times in the same device size (iphone 5s) with the simulator. Now I decided to test it with the iPhone 6, and everything is wrong and not in the place I want it to be. How do I make labels/text fields/buttons keep the same size in ratio to the device?? How could I adapt things proportionally?? Please help.
I was getting the same issue , But after some R&D found useful solution .
Have a look into given link :Set view controller in ratio for iPhone-6 and 6+
Its very easy process and working for me .
I'm sorry for the bad explanations but I've found the way to do it. Here's the video that explained me how use constraints based on proportions and not on pixels.
https://www.youtube.com/watch?v=Gl6DibzPYa4
(The first 5 minutes is basically it)

UITextfield Custom Position moved up because of different iPhone sizes

I have several custom UITextfields in my app. I started this app on Xcode 5 and ran on iphone 5 simulator. After Xcode updated to Xcode 6, I ran the app on iPhone 6 simulator. Now all the textfield positions moved up because of large screen size. I just wanted to know is there anything I could do so that the positions of textfields automatically get adjusted depending upon the iPhone models.
You need to rebuild your interface to handle the different screen sizes. In particular, you need to work with the AutoLayout feature to help determine how you want everything to scale/move/position based on multiple screen sizes. This can be done via the Storyboard (easier but sometimes frustrating) or in code (harder at first but more control later). I usually use Storyboards and it's worked great on several projects.
Do you want it centered and respecting your original layout and margins? a certain distance from the top or sides? everything scaled up appropriately? All these things can be done with AutoLayouts.
Check out the great tutorial here for more information:
http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1

iOS XCode Storyboard controls moved and now look strange in simulator

I am following the course on iOS through iTunes university and working on the calculator project. I moved the controls on the storyboard to make room for another control at the top. Everything looks fine on the storyboard but when run in the simulator, controls are bunch up, on top of each other, and some are clearly off the top of the simulator screen. This leads to the following very related questions.
How does one move controls around on the storyboard? I went to the size inspector of each control (buttons in my case) and changed the 'Y' value (increased it by 10). I did this for each control. I didn't think about it as I was doing it because as I said, all looks fine on the storyboard. Is there a better way to move controls around? I could not figure out how to grab more than one control at a time and move them. Grabbing all and moving or all but one and moving would have been ideal.
I anticipate someone is going to say, "We need more info. " How do I show the storyboard? Is there a xml file somewhere? How is the storyboard saved? How should I show the results of the simulator?
In general, what the heck is going on? Why would things look so different in the simulator?
Is there a better forum/group to ask newbie questions about iOS programming?
My specs are these:
XCode 4.5.2
Ios simulator versions set to 6.0 and iPhone
Any other info needed? Thanks in advance,
Dave
Try setting your simulated device size to 'freeform' instead of 'inferred'. This screen is a bit smaller so the controls are no longer overlapping. The latest xcode sets it by default to ios6 (screen size of iPhone 5)
edit For a better insight in xcode IDE, please refer to the documentation provided by apple (includes screenshots for clarity)
https://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/000-About_Xcode/about.html#//apple_ref/doc/uid/TP40010215

iPhone app view is cut off at the botton when run on iPad

I need your help. I have designed an app to target iPhone only and everything works fine. However, I just realised that when I run it on iPad, I get black spaces around the screen (view doesn't cover full screen of the iPad) and strangely, the bottom part of the app gets cut off when it runs on iPad. How do I get full screen iPad mode without part of the view getting cut off. Thanks
This is normal behaviour(black spaces around the screen) if the value for "Devices:" under Target/deploymentInfo is set to iPhone. In this case you can still test on iPad but with iPhone resolution. (but if it set to iPad you can not test on iPhone).
if you want to get iPad resolution you have to change "Devices:" value to universal.
for (bottom cut) check if your code uses device size for positioning buttons.
Your app must also run on iPad without modification as for
2.10 App Store Review Guidelines
At first, you have to set your the view (on Main.storyboad) to fit all size. That is `wAny hAny).
Then selected the views, add some constrains to them one by one. When you run the app, it should be right. If the position doesn't match your expectation, you can change the constrains. You should know things about AutoLayout. Find some article to read, and practise.
Thanks guys for all the comments. Using your comments and reading and testing AutoLayout features, I am able to solve the problem.

Resources