Xcode 7 Beta 5 - All subviews missing from Storyboard - ios

I've recently switched up to Xcode 7 Beta 5 and I've been trying to solve the UITableView issue that I know lots have experienced. One solution I found was to disable size classes, however, once I did that I wanted to roll back my solution to a commit I just performed before that.
After I discarded all the changes I was presented with my view controllers and none of their subviews visible in them. In the hierarchy to the left they are listed but are 'greyed out'. Can anyone help with solving this?
Screenshot for reference:
It's worthwhile noting that when the app runs all of the ui elements are still present as expected - just in storyboard they are not displaying.

Try checking it in different layout such as any width compact height.
Grey out generally means that your view are active on a particular layout.
You can see the changes when you tap in the bottom wAny hAny and select different sizes...

Related

Xcode 14 - The frame of subviews automatically changing

I have a container view inside main main view of UIViewController which is in storyboard. The containerView have multiple subviews which further have textfields and labels inside them.
All of this hierarchy is in autoresizing model.
Now what is wrong here is that whenever I close Xcode and come back to those views, the subview frames automatically get disturbs and normally go in negative like if it is on 0 from y axis it will now be -2 or -3.
It is happening in multiple controllers and mostly on the storyboards which have more than 7-8 controllers. Auto layout resolves this issue but due to a lot of views it would be a time taking task.
Any suggestions to resolve this problem without converting to auto layout?
Edit:
I have reduced the number of controllers in storyboards as well but it didn't effected and the issue is still appearing
After trial and error, if the stretchable properties of autoresizing are removed and the stretch is handled in subviews then this issue do not happen. I have tried this hack and it was not changing the frame on quoting and reopening the Xcode.

Xcode 6 view controller showing blank screen with autolayout

I'm trying to use view controller that I decided to use auto layout for. Before I used auto layout, the view showed normally like how I intended it to during runtime. But I decided to switch to auto layout (because after all, bigger iPhones are coming), and even after setting it up, getting no issues at all, and seeing that the app scaled well to the iPhone size in IB; I still have a blank screen. To prove it, here are pictures:
So why is this happening? I added the constraints in the square view, and it gracefully scaled to the iPhone view in Interface Builder. If you also look at the sidebar, the alerts for auto layout errors are not present. And IB is rendering everything. But why is the simulator blank?
And yes, I connected all the elements to be code correctly. I verified. And yes, I have code that puts text in a label. Here it is, in the 'viewDidLoad()' method:
override func viewDidLoad() {
super.viewDidLoad()
self.titleLabel.text = "Hello, World!"
}
And I will reemphasise: the app worked before I did auto layout. For this build, I deleted all the elements, relocated them, reconnected them, and added tweaked the view with auto layout unit IB rendered it correctly. But I'm getting different results here.
Please help me. Oh, and sorry for the massive images, I can't figure out how to shrink them.
EDIT: I've gone through and used the view debugger, and tried to capture the view hierarchy to look for clipping or occlusion. Funny enough, the view debugger shows the content properly, and there wasn't any clipping or occlusion that I saw. When I tried to show frames in the simulator though, it didn't show anything. I'm starting to think that this is a simulator bug. Currently, I'm using Xcode 6 beta 6.
I recreated the issue by adding a collection view to a standard view controller and this seems to be the problem:
Having Xcode add suggested constraints gives you this, which causes the view to not show up.
It is aligning the view's left and right to the layout guides (which doesn't seem to be right)
You will have to manually add spacing constraints to your view.
This is what you want:
Try turning on the assistant editor and use Preview while tweaking your constraints.
(source: mattknott.com)
Do your Editing in "wAny hAny For All Layouts Base values" mode. then you will not see blank screen while testing on different devices.
Mode selection can be one from bottom bar.
Good Luck

iOS 7: Misplaced View Frame for "Label - Label" will be different at run time

I just finished an app on iOS 6 and bought a developer account a week ago so haven't had much time playing with the iOS 7 SDK. Just downloaded the Golden Master version and trying to upgrade my app to be compatible with iOS 7.
I received a lot of warnings saying
Misplaced View Frame for "Label - Label" will be different at run time.
and I am unable to run the program. The project contains tableview and its is parsing and displaying XML feed from an RSS.
How to fix this issue?
The accepted answer will fix the problem, but that's not a good solution because it'll remove all your constraints. If you have spent hours on the constraints then don't do that.
If you click the triangle next to the warning you can get the explanation of what is misplaced. Then you can just move the frame to where it's supposed to be. For example:
In this case I just moved my Text View's y position to 94 and the warning will go away. This is because one of my constraints will force the view to be somewhere else when the app is running, but the position is different than where it currently is in the storyboard.
Another way to move the frame to the right position is to click on the warning next to the View Controller name in your storyboard, and then click on the yellow warning sign, and click update frame.
These two methods are not destructive and will not remove your constraints. If anything it'll show that you may need to do minor readjustments in your constraints.
I had the same issue and I get below response form Apple:
You need to update the constraints to match the frames of these views.
I did the following:
Editor -> Resolve Auto-Layout Issues -> Clear all constraints in ** view controller
then I reordered my objects again in the view.
PS: Try Enrico's solution first.
I had the same issue what you need to is , update the constraints or update the frame.
On storyboard you have a small tool bar as shown in below image.
Please see the meaning:-
You can either choose "Update Frames" or "Update Constraints" and Use "Reset to Suggested Constraints".
This will resolve the issue regarding misplaced View.
Don’t drag and drop views to make adjustments to layout. Edit the applicable constraints instead.
Please , let me know if you not clear.
If you are having troubles finding the Update Frames in xCode it can be done like so:
None of the answers work in all cases. As of recent version of Xcode, using a UISearchBar, enabling scoping field enabled in IB makes the search field appear double height (but doesn't show a the scoping bar beneath it). Whether or not you add a height constraint (of any height) to the search field, you'll get the warning that it is a misplaced view that will be 88 H at runtime but is 44 H in IB. Updating the frames (any or all frames) doesn't resolve it. Seems like a bug in IB.

UILabel in different position for 2 different screen sizes

I have a UILabel that i placed in the top left corner of the screen in the Storyboards. I disabled "Autolayout" and it works perfectly fine on the iPhone 5 screen. The problem comes when i try them on any of the smaller screens like the iPhone 4. The label is then placed on the bottom right corner. After this issue, i tried to programmatically 'fix' the position in the "viewDidLoad" method of the view controller, but it stills moves position and the problem continues.
Ive been scratching my head about this for a while!
Any help would be appreciated.
I would suggest that you turn autolayout back on. If you get the constraints right, this situation (two different screen sizes) is exactly the sort of thing autolayout is really good for. There's a very good reason why Apple migrated autolayout from OS X to iOS at exactly the moment the iPhone 5 screen appeared on the scene!
try to fix it at viewWillAppear
Go to the utilities panel, click the tab "Show size inspector", and change the autosizing. Then drag your component in your storyboard's view so that it stays in one of the "borders". If you do not need to support older iOS versions, I'd recommend you to figure the proper way with auto-layout though.

Pinning width on UITableView using auto layout does not behave as expected

I'm currently busy designing my custom view in a seperate view xib file using auto and is really struggeling to figure this one out.
The problem that I'm facing is that when I set a fixed width constraint (pin width) on the table view say for instance 320 points (in landscape mode), as soon as I test the view by setting the orientation to portrait the contraint is lost and the table gets shrunkken down to 65 points?
What exactly am I doing wrong here or why is that? Or maybe I'm just missing something?
Thanks
I recommend to use the new autolayout-option of iOS 6 only in very special cases. I have tested this option very intensively and find out a lot of bugs, e.g.:
in the console appear messages indicating apple bugs
it slows down your UI dramtically
while layouting constraints suddenly disappear
the app sometimes crashes with undocumented error messages
Using autolayout is currently very frustrating. Instead of using autolayout I use
- (void)viewDidLayoutSubviews {}
to adjust my UI programmatically, which is much easier and faster (at developing and at runtime).

Resources