Xcode 7.1 - Prototype cells in storyboard not showing up - xcode

I just updated to Xcode 7.1 and I noticed that all of the prototype cells in my storyboard tableviews are showing as blank and their elements are missing. Sometimes I can see the prototype cells at the top of the tableview, but when I scroll down to view the others all the cells appear blank and white again.
Has anybody else experienced this and is there a quick fix?

Yes, I'm also experiencing this issue.
As a quick workaround, you can set the View Controller simulated size to Freeform, and make it big enough to accomodate all of your custom cells.
Select View Controller
Change its height
Changing it back to Fixed will revert it to the regular size.

Selecting the Table View and selecting the 'size inspector' icon in the 'utilities' pane and ticking the checkbox 'Preserve SuperView Margins' in the 'view' section seems to reset it.
preserve superview margins
However it's not fixing the problem, it worked fine in previous versions and I agree with #matt to file a bug report with Apple
Edited: Seems they fixed it in 7.1.1

Related

How to fix "Scrollable Content Size Ambiguity" in Xcode 11 (iOS 12, iOS 13) using Auto Layout

When using Auto Layout, I am unable to set up a simple UIScrollView in my view controller in Xcode 11 beta. I know that I must constrain the scroll view to the edges, and then set the scroll view width and height equal to the width and height of the entire view that contains the scroll view. However, I am not getting the option to set equal widths and heights when I attempt to do so.
When I do the right-click-drag from the scroll view to the entire main view, I get the following options:
Leading Space to Safe Area
Top Space to Safe Area
Trailing Space to Safe Area
Bottom Space to Safe Area
Center Horizontally in Safe Area
Center Vertically in Safe Area
In other videos, there is an "Equal Widths" and "Equal Heights" option that I don't seem to have.
Am I doing something wrong, or did Apple change the way scroll views work in Xcode 11?
Disabling the content layout guides in the size inspector (ruler icon) in properties
I was having the same issue, and by disabling the option it was gone.
I stacked with that problem as well.
Found a good guide that helped me:
https://useyourloaf.com/blog/scroll-view-layouts-with-interface-builder/
Basically what you need is 9 constraints (assuming you want to scroll only vertically):
1-4: ScrollView to Superview (top, bottom, leading, trailing). Make sure to connect it to parent view and not to safe area.
5-8: Content view to Content Layout guide (top, bottom, leading, trailing).
Content view Width equals width to Frame Layout Guide.
I also encountered this problem (Version 11.0 beta 3 (11M362v)). I solved this problem by first setting the layout in xcode10 and then running it in xcode11. I haven't found any official instructions yet, proving that this is a problem with xcode11, but for now, I guess this is a problem with xcode11 bate.
After spending a long time on this scrolling issue in Xcode-11. The conclusion on this issue is you have to choose the scrolling option while adding a new constraint.
You can refer to the following screenshot to resolve your issue.
These mentioned solutions worked for me.
Disabling the content layout guides in properties worked for me.
Well, I was facing this issue but I have found a solution.
Problem is the Safe Area.
Embed Scroll view in a UIview.
give Top, Bottom, Right and Left 0.
now give constraints of scroll view with this view.
Add Equal height and width of content view to this View.
parent view is automatically giving Safe Area. All you have to do is just embed your scroll view in a UIview and then give equal height and equal width of the content view to this view.
#Vadim's answer worked with a little adjustment.
Nothing else worked and I didn't want to disable 'Content layout guide'. Since apple enabled it, why disable it. So there must be something I'm missing or it's a bug.
Vadim's answer is:
I stacked with that problem as well. Found a good guide that helped me:
https://useyourloaf.com/blog/scroll-view-layouts-with-interface-builder/
Basically what you need is 9 constraints (assuming you want to scroll only vertically):
1-4: ScrollView to Superview (top, bottom, leading, trailing). Make sure to connect it to parent view and not to safe area.
5-8: Content view to Content Layout guide (top, bottom, leading, trailing)
9: Content view Width equals width to Frame Layout Guide.
All good, but it didn't work,
But then I realize that the above 6 and 8 (trailing and bottom constraints to 'Content Layout guide') constraints are a little weird. They had positive constant values instead of zero. Like the below image. (constant equals to width and height of the scroll view). I changed them to zero and now it all works.
For me, initially the Content Layout Guides is in disabled state by default in ScrollView. So I just enabled and disabled the Content Layout Guides then the error disappeared automatically.
Xcode 11+, Swift 5.
I solved my issue, I prepared video and code

UITableviewcell width not filling the screen

I don't know if this is a bug with AutoLayout or Xcode but I've realised that if I run my application on a device which isn't the same size as the device in my storyboard, the elements are adopting the incorrect size.
I.e. Selecting View as iPhone SE and running the application on an iPhone 7+ The size of my tableview is the width of an iPhone SE screen, this fixes itself when I reload the view and then it then adopts the width of the iPhone 7+ screen.
Just a note as well the table view doesn't have a fixed width and is pinned to the top, bottom, left and right with 0 spacing and also I'm changing the height of the cells programmatically in code if this could affect it at all as well.
Video: https://drive.google.com/open?id=0B0QLbDLfJn6_YzljUGg4RTUwaTg
Views that come from a xib (or storyboard) have their IB frame values when they are created, before they are added to the view hierarchy. So a case like you describe is probably that something is accessing a view loaded from a xib before it has become part of the layout process and resized.
This would also explain why it's fixed when you go away and come back. The first time, it got the values before they were final, but the second time the values are already final and correct.
Layout code called fromviewDidLoad() for view controllers, or awakeFromNib() or initWith(coder:) for views is the likely cause. Layout code called from viewDidLoad() is especially problematic because it was fine up to iPhone 5s, but would now cause this problem.
It's impossible to say what exactly the issue just from this. From the NSLog statements visible in the video, the issue is whatever code calls that "weather view width". That is being called too early in the layout process. It needs to go in viewWillAppear or viewWillLayoutSubviews to make sure the correct values are ready for whatever calculation is dependent on that. Hope this helps.
I can't seem to recreate this. I would recommend double checking for any updates for Xcode and the Developer tools (softwareupdate --install -a).
Incase you haven't, restart Xcode.
EDIT: Disregard this answer, please read Mike Sand's post.
Try self.view.layoutIfNeeded in viewDidLoad or in viewWillAppear

Xcode auto layout buttons not resizing

I have looked at many tutorials and just can't seem to get Buttons to resize and layout properly using Xcode 6 auto layout.
The tutorials that make the most sense just use Views as examples.
Trying to build a Universal soundboard app with buttons arranged in the attached picture.
I also tried putting all the buttons in one View container but still no luck.
What am i missing?
Thanks so much
Select the button you want the constraint on, and command click it's parent view.
Next, select add new constraint (at the bottom of xcode), click "Equal Widths", then click add constraint.
Select the object.
Double-click on the constraint rectangle (not obvious! "Edit" takes you somewhere else)
Then at the right hand side of xcode the attribute inspector should
come up:
At the multiplier property you can make a ratio or a decimal of the percentage value you want. If you want the button to be one fourth of it's parent view, then set the multiplier to 1:4.
This might not be the most ideal answer, but it's the best I can offer. Hope this helps!! Good luck!
You can check out this
How to create equal spacing between multiple label in ios xcode 6.3 using AutoLayout Constraints
You can also check out Evenly Spacing Views in Auto Layout
If you still have problem then comment me I will try to fix your issue

XCode 6.1.1 UITableView White Spacing Gap

I have been running into some issues where my UITableView after being dragged and dropped into my view controller appears with a sizable white space gap from the top of the element ot the start of the prototype cells. Why does this occur by default and is there a way to remove this? Maybe in the size inspector?
I was having the same issue in 6.3.2 and all I had to do was to go to the ViewController's attribute inspector and uncheck the "Adjust Scroll View Insets" in the layout information section.
Sorry, they won't let me post images, but that solved the frustration for me. Hope it helps someone else.

Xcode 5, ios screen issue

when I open my iOS project in Xcode 5, I see spaces bottom and top of the view controls (in 3.5 and 4 inch screens).
There are no problem in Xcode 4. Image view is not covering all view controls area.
I am setting image view size with manually but I have 200+ view control.
How can i quickly fix ?
Have you tried to hide status bar ?
It can cause the issue you are having
If the spaces are only appearing in Interface Builder, you can tell IB what you want to see during layout. Click below a scene on the bar where the controller, first responder, files owner etc. are located. Now your whole scene is selected. Then show the attribute insepctor (Cmd+Alt+4) and select what you want to see in your scene.
Attention - this has nothing to do with your code! Its just how the scene is presented in the editor (simulated metrics)!
If this was your problem, please mark question solved.
If not, please add some more details.
Thanks.

Resources