NSTableView messup with other controlls on mainView - xcode

I have added NSTableView on my mainWindow and then I want 2 button (up arrow and down arrow) to add on mainWindow but they will overlap the tableview.
But when NSTableView loads data or scrolls my button hides.
Please help me out how can I achieve it.

You need to take advantage of Sizing and/or autolayout.
You must have not set for those buttons. Check for buttons and for table view.
When you draw tableview you will see blue helper line, that guides you to use properly. And draw table my checking it should meet top, left and right blue lines.
For button put them in bottom and check for line below them as well as from left side.

Related

Trouble with UIScrollView and Constraints

I'm having trouble with UIScrollView and Constraints.
I want to display a FAQ inside my application. This will include several questions and answers, with various length. It won't change after launch, so I handle everything directly in the storyboard. However, it has to work on different iPhone screen size (from iPhone 5 to iPhone 6 Plus).
So what I'm trying to do is :
UIView
UIScrollView
UIView (FAQ1)
UILabel (Question 1)
UITextView (Answer 1)
UIView (FAQ2)
UILabel (Question 2)
UITextView (Answer 2)
...
Here is an example of what it looks like (color on purpose, to see at runtime) :
Now if I apply some constraints, I manage to get that :
However it is not scrollable and the text is out on the right side.
If I run the same thing on a smaller screen, I get that :
Which is scrollable this time (not more than what you see on the screenshot...) and the text is still out.
Is there anyone who could help me understanding how to use Constraints properly with an UIScrollView ?
If possible the text size has to shrink on small screens.
If it isn't, it should keep the same size but the UITextView will be scrollable too.
The best way to use scrollview and auto layout is to add a view inside the scrollview and pin all its edges to scroll view and equal widths to superview, Pin all edges of scrollview to superView
pin top, left , right and height of your label to your FAQ1 view.
pin top of your text view to label and left right and bottom to your FAQ1 view.
pin the height of your FAQ1 view, and left and right of your faq1 view to content view.
Follow step 1 to 3 for all your faq views.
Pin top of your faq1 view to top to top of content view
Pin the top of the next faq view to bottom of the previous faq view.
pin bottom of the last faq view to bottom of content view
when adding your faq1 view pin its top to top ,left and right to contentView's top left and right with necessary padding.
You can find the sample code here
Hope this solves your problem

Xcode - TagTextField Component: Dynamically resize superview to fit subviews

I have created a UIView with two subviews; a uibutton and uitextfield. The button is on the left of the text field and constraints determine the horizontal position for the text field automatically. Similarly the UITextfield expands to fit it's text content dynamically using constraints too.
I want the superview (UIView) to expand to the width of the both controls automatically but can't find a way to do so. Could someone suggest a way to create constraints for a superview so it adjusts when it's subviews change size?
Thanks
D
Update
Heya, So I am trying to create a Tag-Textfield like the following, where the user can enter text on the right or press a button on the left to prompt a modal popover list:

Superview not resizing with subviews

I have a window into which I horizontally add two subviews. Into each subview, I place a variable number of subviews made up of a vertical slider, a text field rotated 90 degrees and placed to the left of the slider and another textfield, placed just under the slider. The slider subview's constraints are done in code, the parent views are both done in IB. When I add more slider views to the left window than the subview can handle in its default size, it resizes horizontally and forces the window's content view (and window) to also resize horizontally. Great, that's just what I want. But if I add more slider subviews than can fit in the right subview, they just get squeezed together and the subview does not expand as the left. I layout the slider views using code with this category converted to support NSViews, instead of UIVews:
UIView+AutoLayout1: https://github.com/jrturton/UIView-Autolayout
The constraints for the left and right subviews are more or less the same. I can't figure out why the right view does not resize as the left view does.
Here is a link to a sample project that demonstrates the problem:
SliderTest
Some someone help me out with this?
Also, a secondary question as I think my slider view could use a little work:
When a view is rotated using setFrame(Center)Rotation, do the top, right, bottom and top edges remain along the same edges or do they reflect the new orientation of the rotated view?
Thanks
I found the problem. The constraint between the left view and right edge of the window was fixed at 233 instead of >= 233. I had this at some point in the past, as I was adjusting the constraints to achieve the desired behavior and just overlooked this one through the troubleshooting process.

NSOutlineView badges in NSSplitView

I have an NSOutlineView which I draw badge numbers to the right side of cells using drawAtPoint:, NSAttributedString, and of course NSBezierPath. My problem exists when resizing of the outline view occurs when within a subview of an NSSplitView. The badges move along with the resize to the left or right. When they get to the text of the cells themselves they do not stop or truncate the text under them. It just flies right over.
Is there a way to have the cell recognize the custom drawn view next to it and truncate text accordingly? I have tried the solution PXSourceList already, but that did not help either.
"PXSourceList solution" working good. You subclass NSOutlineView and overload frameOfCellAtColumn for this particular task. At this function you need to decrease width of cellFrame, returned from super call, by the width of your badge plus padding.

How to add a button or image to a vertical table header of scrollview?

I have seen a lot of programs had some buttons or images in the vertical or horizontal scrollview table header or bottom and click it to invloke some events, But I have searched interface builder library and not found some widget I can used , how these programs to implement it ? Thank you very much!
To add just above the vertical scroll bar, see -[NSTableView setCornerView:].
To add to the left of the horizontal scroll bar, you'll need to subclass NSScrollView and (in addition to creating/configuring/adding the auxiliary view of your choice) override -tile. You'd call [super tile], then adjust the horizontal scroller to make room, then position the auxiliary view to taste.

Resources