So I'm doing a tut on iOS 9 development with Xcode 7, and in the example I'm currently doing the instruction is adding constraints using ctrl+drag and clicking on a second image. Now my issues isn't with that process, my issue is when the video asks me to set left constraints (the right image attached) I don't have that option (the left side of the image attached). I tried "leading" just to see what it would do and it did not achieve desired results. I'm guessing that this is changed in Xcode 7 and there is a new method of achieving this result?
Any help is appreciated, thanks!
EDIT: To update my question as per a suggestion below, here's what's happening. I have a background image view. When I am lining up image buttons along the background image, the first one is just fine, once I select the second one, and add the leading constraint, then lock in the width and height in the main constraints - it flies off the page somewhere. The background image is horizontally and vertically aligned to the container, and the main reason I'm doing this is I have "landscape mode" pulled up in a main preview window and I want to make sure that everything is looking good in that mode.
I have tried starting a new project all together and I get the same result. Again the tutorial I'm following was using Xcode 7 beta, so not sure if that has something to do with it. I'd like to lock in on the problem instead of skipping over it in case I run into this in the future.
Thanks!
Try using the main constraints menu at the button of Xcode.
See below screenshot: click the element you want to add a constraints to and it will give you the options you need.
Cheers,
Tal
Related
When ever I try running the simulator, this thin white bar on the side of the simulator appears. There has been times that i've managed to remove it but Im not sure how I did it.
Click here to see example of the issue i'm having
Kind Regards,
Chris
If you're using autoLayout, this would appear to be an issue w/ not having a trailing constraint. http://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2
If not, I'd recommend looking into it as the pieces may be settling in the view w/out constraints and creating the bar to the right.
I cant see the Labels, Button etc in the View or their constraints though the Labels and Button appears on the side of the storyboard. And when you run the program in the simulator you can see that they are there.
The project from my colleague who uses XCode 6.3.1 and I am using XCode 6.3.2
and he doesn't have this issue. When he updated his to to the same version I have he had the same problem; so he went back to the previous version 6.3.1.
Now the problem persisted on my device even when I removed the 6.3.2 and substitute it with 6.3.1
stackoverflow prevented me from uploading the images but I can send it by email to anyone to see the screen shots
I think I found the answer but yet the labels seems to be shifted out of the view. but the Answer is: This problem occurs when one of the users design the view controller using the compact or any other dimension other than Any X Any. to fix the problem, click in any of the objects created ( label, button..etc), and go the attribute inceptor, and scroll down to the bottom and you will find a check box with the word installed. there will probably be more than one. Look for the one that is not highlighted, and highlight it. This should fix the problem.
Another faster solution instead of going over each object you can deselect
Use Auto Layout
Use Size Classes
then select them again
My app works good on iphone 4s, 5 , 5s simulators. On iphone 6,it shows up weirdly. It does not occupy the entire screen
What could be the issues?
if you are using the Auto resizing just under stand the concept for example
assume that u have a book self , u need to layout the book in the book self so u need to do the following steps
initially arrange the book self (this is your main View).
arrange the all books in inside the book self where u need the location (this is your subview, buttons, labels, all UI Elements).
u keep to follow the above two steps in always. got it
need reference follow the apple tutorial
this tutorial may also help u
The black view is an added view? If the goal is just to set the background color, better to just set the color of the root view.
If you're not using autoLayout (and I don't reccomend it, it's more trouble than it's worth in most cases) one simple to handle different screeen sizes is programatically.
Everything in the view in Interface Builder needs to be an outlet.
in -viewDidLoad, set the center of each view. For example, to center the mobile number text: [self.enterYourMobileNumberLabel setCenter: CGMakePoint(self.view.center.x, self.enterYourMobileNumberLabel.center.y)]
You could also set the frame for more percise handling, etc., using margin constants. Frames are often more code and more cumbersome, but AutoLayout is a nightmare.
Resolved the issue. Thanks for your valuable responses users.It has got nothing to do with Autolayout or autoresizing.
Just go to images.xcassets, right clicking in the navigator area, add launchImage. Then select your project (or target), go to general-->App Icons and Launch images and set Launch Images Source as Launch Image and most importantly, set Launch Screen file blank.
The app would now work well in iphone 6 simulator too.
link to a video with bug
I simply created a project in xCode. Then I added any UI element to a view. Then I tried to resize this item to left and to right. No code, Interface Builder was used only.
I have checked with some types of projects for iOS and with UILabel and UIButton. The result is the same: when I try to resize the item from the left then it moves the parent view/viewcontroller instead.
Uncheck "Siblings and Ancestors" under Resizing Behavior in Xcode 5 Storyboard.
Voila! As such, resizing your UI elements will not cause your view controllers to move.
You need to uncheck the "Siblings and Ancestors" in your .xib/.storyboard file. See below screenshot of how to toggle this behavior on and off:
As has been said before, you must uncheck the "Siblings and Ancestors" option under Resizing Behavior in the Xcode 5 Storyboard.
The specific purpose of this feature is to be able to resize large groups of objects all at once. For instance, lets say that you have a Table View and you resize one of the cells. In this case, it would seem petty, since you would just have to resize the Table View Controller, but it becomes extremely handy once you have layered objects such as that.
Sorry for the somewhat duplicate answer, but you did ask for an explanation of why a feature like that would be added.
Additionally I have found out that another computer with the same version of xCode works with the same copy of project normally.
I didn't know how to solve this problem without uninstalling of xCode.
So I uninstalled it using AppCleaner and installed it again.
I have a strange thing that recently happened. The simulator keeps starting in horizontal view. Is there a setting to make it start in portrait view? I keep digging around for that setting but can't seem to locate it.
Thanks and sorry for such a simple question.
Try rotating it with CMD + left arrow, that might do the trick.
The order of the 'Supported interface orientation' items of your project-info.plist file is key.
Check if the "Portrait (bottom home button)" is on the very first position in the list. If not, just move it up.
(from this answer)