Shouldn't an NSTableview autoresize when its superview resizes? - xcode

I have an NSTableview on the contentview of an NSWindow. When I resize the window, I would like the height of the NSTableview to resize. This isn't working.
To make sure I haven't set something incorrectly, I created a new mac project, view-based, storyboard. In IB, I added an NSTableView to the view. It looks like the default is to have autoresizing on, so I made no changes. Run this sample project, resize the window and the tableview does not resize. I guess I am missing something. What is it??
BTW, I am using xCode 6.3

• While viewing the xib, select the Bordered Scroll View that contains your table.
• In the lower-right of the xib canvas, you'll see 4 icons. The 2nd icon is called "Pin" if you hover your mouse over it. Click that.
• In the view that pops up, click the 4 red constraint connectors, then click "Add 4 Constraints".

Related

How to fix scrollable content size ambiguity in xcode 11 using auto layout beta 7 UIKIT

When using Auto Layout, I am unable to set up a simple UIScrollView in my view controller in Xcode 11 beta 7. 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?
I'm using beta 7 currently
I was finally able to successfully add a UIScrollView using storyboards in Xcode Version 11.0 (11A420a) after much trial and error.
You can add the scroll view directly to the root UIView of the VC or, if you needed to, add it to another UIView under the root view as needed by your UI Design. Constrain the UIScrollView parents normally for whatever your needs are.
Here is the key : when you add the UIScrollView to the storyboard, click on the Size Inspector with the UIScrollView selected. You have to UNCHECK the box that says "Content Layout Guides".
If you do this you can set the scroll view's contraints normally (I did 0-0-0-0 to superview). Then I added a UIView to the scrollview and set it's constraints to 0-0-0-0 and a height of 900 (which is what I wanted).
This will give you constraint errors in red when you set them. They will be fixed by setting the width of the UIView equal to the width of the UIScrollView.
Set the UIView width equal to the width of the UIScrollView view by Ctrl-right clicking on the UIView, dragging to the UIScrollView, and selecting the "Equal Widths" option. This should get rid of your constraint errors.
You actually can then go back to the UISCrollView Size Inspector and check the "Content Layout Guides" checkbox, no constraint errors will appear.
Disable the content layout guides in scrollview properties.
Hope it helps.. :)

Xcode Storyboard - Table View doesn't expand automatically when dragged in

In Xcode 7.3, when I drag in a Table View from the Object Library to the Storyboard for a single view app, it doesn't automatically expand to the full size of the view. I seen it do that in my Udacity class videos and in other videos on YouTube. Is there a setting in Xcode that will correct this? Thanks.
Yes, you need to "pin" the tableView at the ViewController. Am I right you have a simple ViewController and add a tableView to it?
Now, you need to open the Pin Menu and uncheck the checkbox "Constrains to margins". Now you add the constrains to the top, left, right and bottom to 0 and save it. Now the TableView should stretch the whole display.
If you only show a table in the ViewController you should use a UITableViewController.

Text views and image view disappearing from view controller in Xcode 6.1 storyboard

I updated to Xcode 6.1 to fix an error I was having with the Interface Builder Cocoa Touch Tool spiking to 99% CPU usage when I used the storyboard, which would freeze Xcode. Now that that error is fixed, I have a possibly even more frustrating error.
When I use the storyboard, while I'm working on a UIViewController, my UITextView, my custom UITextViews (which are subclasses of UITextView, but for all intents and purposes in the storyboard, they're UITextViews), and my UIImageView suddenly disappear!
Here's how the default main view inside my view controller looks right now:
Main View
View
Activity indicator
Scroll view
Label
Text view (x=0, y=-65, width=0, height=0) ERROR!
Label
Custom text view (x=0, y=-65, width=0, height=0) ERROR!
Label
Custom text view (x=0, y=-65, width=0, height=0) ERROR!
Label
Custom text view (x=0, y=-65, width=0, height=0) ERROR!
Label
Label
Custom text view
View
View
Label
Button
Image view (x=0, y=0, width=0, height=0) ERROR!
ViewX
Label
Custom text view (x=0, y=-526, width=0, height=0) ERROR!
Width and height Constraints for this view.
Button
Width and height constraints for the scroll view
Center x and y constraints for ViewX within the scroll view.
Center x and y constraints for the scroll view within the main view.
It all started when I adjusted the size of the view controller using "freeform" in order to see views that were off the view controller screen. Once I used cmd-Z to change the view controller back to "fixed" (to the normal size), the missing elements appeared again and everything seemed fine. However, later on, I was editing the view controller and suddenly...bam! They're gone. And when I reset all of them to where they were supposed to be, it just happened again (resulting in the above described x, y, width, height values).
:-(
Does anyone know what could be wrong? I never had this error in Xcode 5.
EDIT:
I was able to use cmd-Z to get the view controller back to normal. Then I restarted my mac and reopened Xcode. Now, I've noticed that the error occurs whenever I resize anything in the storyboard by dragging with the cursor (it doesn't happen if I resize something using the width and height properties on the right panel in Xcode). It happens on other view controllers as well. Even in a view controller that has only a UILabel and a UIImageView in the default main view, when I click and drag the edge of the label to resize it, the image view disappears with values of x=0, y=-64, height=0, width=0.
CONCISE SUMMARY:
In the Xcode 6.1 storyboard, every time I resize any elements in a UIViewController, all UITextViews and UIImageViews collapse and get shoved -64 pixels above the upper left corner of the view controller.
UPDATE
It appears that Xcode 6.1.1 has fixed the bug.
Another workaround is to add constraints to the layout Before resizing of any views. (add missing constraints e.g.). The bug only seems to occur when there are no constraints available. I have reported the bug to Apple with Bugreporter.
Edit: So, at least it seems that Apple Bugreporter is working. The problem is fixed in XCode v 6.1.1.
Seems it's a bug in Xcode 6.1 !!
The current solution is you should resize your elements from the Size Inspector.
Never do the resizing by mouse...
If you uncheck "Use Autolayout" then it won't occur either. Though, you're back to using the old "springs and struts" method. Still, this can be set on a view controller by view controller basis so it's not too bad.
I was having the same problem. I just went to the Apple Developer website and downloaded the beta version of the new Xcode and they fixed this bug!
I just installed XCode 6.2 Beta and the issue seems to be fixed there.
There are 2 types of 1 is main storyboard and 2 is launchscreen storyboard
Your are placing all your views on launchscreen this appears when you app first time then it will not appear
Place all your views on main storyboard instead of launchscreen

xcode ios 7 fixed height of tableview with statusbar change and in ib

I need to make my tableview not change height at all. Not shrink when statusbar is changed. I am using storyboard and i have another viewcontroller with a embeded tableview where the tableviews height stays the same no matter what.
In interface builder when switching from 3.5" to 4" the tableview changes size. I have fixed this by setting height programmatically. However the height changes when statusbar is changed. I cant seem to find the property in IB that turns off this autosizing feature for my second tableview. Im am not using auto layouts. I dont know why the height allways stays the same on my other tableview in my other viewcontroller.. Can someone please help me out??
Auto resize subviews was the property for the main view that was enabled . Disabling this fixed it.

Device orientation using storyboard and uitableview problems

I am using Xcode 4.3.3 and storyboards i have a UITableView but when the device orientation changes from portrait to landscape the spacing is all messed up i also do not have a .h or .m file for my tableview because the cells are static any help is appreciated
Modify the struts and strings of your cell, label, etc in the size inspector of the utility navigator (Select what you want to modify and press Command-Option-5). In the box labeled Autosizing, select and deselect the connectors and arrows to make the item show up in the correct way. The Example box on the right shows you what the item will look like when your orientation changes.

Resources