iOS XCode Storyboard controls moved and now look strange in simulator - ios

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

Related

Center a UIView inside a TableViewCell

I've been facing an weird issue which I have never experienced before (pretty new to iOS). I am trying to develop a blog reader app and I am using a UITableView inside my main View. Within the TableView I have added 1 prototype cell and modified it's height to be somewhat bigger.
In order to create a "floating", "shadow" or "card" effect within the TableViewVell I have added another View which will contain a cover image and a summary.
The problem I am facing is related to the layout that is displayed by the Preview Assistant for Storybords.
Even though for iPhone 8 (xCode 9.1) everything looks fine based on the constraints that I have put in place, for iPhone SE and 8 Plus things look weirdly different even though during the simulation things do not really look as described.
I have watched WWDC Videos, YouTube Videos, even some great tutorials but none seem to go beyond the basics and actually cover this issue that I am facing.
Here is a screenshot:
XCode Storyboards Preview
I made a simplified demo ofthe project which can be checked out on GitHub:
https://github.com/sebastiannitu/ConstraintIssues
I would very much appreciated if seomeone would calrify this issue for me once and for all. I am sure it's just me doing something silly but I cannot really waste any more time with this. I've already invested about 2 weeks in trying to figure this out!
Thank you very much for your replies in advance!
It's a mild bug in Xcode, but no big deal. Do this:
Change the device type in the canvas, e.g. to iPhone SE.
Switch away to your code, e.g. ViewController.
Switch back to the storyboard. Notice that the constraints have now fixed themselves in the canvas!
Show the Preview for that device type.
So it's mildly annoying, but it does work. Here's the preview for the iPhone SE:
Here's the preview for the iPhone X:
your constraints setup is fine . problem is with only assistant editor. if you run it in your simulator, View (orange View) will resize currectly.
Here is the screenshot for orange View, when running in iPhone 8s (left) and iPhone 5s.
i am not uploading project, but if you have problem then let me know.

Xcode8 Controllers are Grey which are designed in Xcode 7 with size classes

I am making my iOS Application Compatible with iPad.I have designed the UI of my Application with Xcode 7 with size classes which is more specifically designed for iPhone, Now i have to upgrade it to support iPad also.
Now with Xcode 8 when i select iPad from Storyboard with Device Pan then most of the controller are Greyed i.e. those controllers are not showing on iPad on the device also and on the Storyboard also. Please check the screenshot for that
I know the reason why they greyed out, because they are designed with size classes for a different size.
Now my question is, is it possible somehow to use this controller for iPad without Redesigning the UI and updating the Auto layouts, as of now i am not seeing any way to make this controllers available for iPad.
Also i have tried with a way but i think that will be very long, I have to delete this controllers and then add it back and set the layouts again.
Also another way would be design separate storyboard.
So please suggest me what will be a better solution to overcome from this.
Thanks
Even after compatibility conversion to Xcode 8, if still it doesn't seem to work, then you need to check if there are any leftovers like below:
If you want to make sure it works with any width and height, find the constraint:
and remove it by clicking on the x, leaving only installed checked:
That should solve it for Xcode 8.

How to resolve Autolayout issues after updating to Xcode 8.1

I have designed user interface in storyboard in Xcode 7 its working fine when i updated Xcode 8.1 and opened the storyboard the result is below.
I don't know what apple actually doing with this, When ever new update came i struggling on this kind of issue. Can some one guide me how to resolve this?
Thanks
Click on the red button that shows the problems, and see what's wrong, and fix them. Very often you just fix the frames of your views. And then you tap on the various device sizes and check if your layout works with every size.
They did make changes with new xcode 8.0, but I believe its easier then ever.
The concept is same behind only few changes.
Like before you need to do update frames, but now they make it easy so you can view a live preview of your layout without going into preview in show assistant editor.
Just click on device button and it automatically updates frames and shows you your layout.
For more information see: A Beginner’s Guide to Auto Layout with Xcode 8

iPhone Simulator vs. Main Storyboard Preview

I have many layout constraints for a particular app, and in the main.storyboard (preview) the apps look a little bit off, but when I run them in the simulator they look how I want them. So there is disconnect between the two.
I saw the question answered that fixing the constraint warnings would then make the two appear identical.
However, I do not want to try to fix these warnings. A lot of time went into finally figuring how to lay all this out, and I'm worried fixing these (38) constraint errors will screw everything up.
My question is...with the disparity between the preview and the actual device simulation, which one will actually appear if the app is run on a real device? I would assume the one showing in simulation, but I'm really not sure. Is it safe to ignore the errors and the strange main.storyboard (preview) layout it shows me and go with the simulation? It looks how I want it for each simulated device, so I'm weary of changing anything now. Thank you!
According to my experience, Xcode has some problems in storyboard. If you have a constraint which makes a view becomes visually invisible, you will get a warning about this constraint. You can quickly fix it by clicking the warning icon BUT if you close you project and reopen it again, the warning will be there.
The final result should be the UI shown in simulator instead of interface builder or storyboard.

iOS simulator screen size

It is just 2days to start iOS programming.
So I'm very beginner in this area.
<--This image is in iOS simulator. As you see right part is cropped.
<--This image is original UI.
I don't know why some parts have gone.
I am using MacBook Pro 2011 with Yosemite OS and brand-new XCode.
I tried cmd+1, cmd+2, cmd+3.
Please help me.
Thank you in advance.
Go to file inspector and uncheck the "use size classes" option, this is due to newly introduced size class feature to support all devices in ios 8
The new user interface works with all sizes of devices at once. The default size is 600x600 as you are seeing. When you simulate, is uses autolayout and constraints to arrange objects for the desired screen, aka an iPhone.
If you want to place the label in the center of the screen, Ctrl+drag from the label to the background, release mouse and buttons and the constraints options will appear. Click Center Horizontally in Container and Center Vertically in Container.
Run again. It will be centered.
Best regards
Select your view controller and find size inspector, Change fixed to freeform and give whatever size you want
I had a closely related question, and Mehul Thakkar's answer helped me to get where I needed to be, but I'm adding a new answer to flesh out both the question and answer a bit.
I was working on an iPhone app for iOS 8 that was shrinking the interface on larger screens to the size of the iPhone 4s. I don't use storyboards or Interface Builder nib/xib files at all, and do everything programmatically; for iOS 7 and earlier, I didn't bother making an explicit launch screen as my UI was simple enough that it loaded very quickly and a launch screen wasn't necessary.
Anyway, after finding this page and poking around a bit, it appears that creating a launch screen storyboard or nib/xib is now necessary on iOS 8, if you want your application to run at the correct size? (At least, I couldn't find any other way to coerce Xcode to do it in the project settings or whatnot.)
To do this, I created a new launch screen .xib file, unchecked "Use Size Classes" in the "Interface Builder Document" section of the File Inspector of that .xib file, and set the "Launch Screen File" under the General tab of my target settings to use that .xib. After that, the app ran at full screen size again.
This works for me and I guess I don't mind putting in a few minutes to turn the .xib file into a proper splash screen, but I'd be interested in hearing if there are other/better ways of making things work in iOS 8 and beyond, for those of us who hate our lovely code being tainted by the presence of those nasty storyboards/nibs/xibs...

Resources