This is a small thing, but quite annoying.
In Interface Builder, if I have a superview with subviews, and the subviews cover all the superview's area, it becomes not possible to select the superview by clicking.
The solution is to select it from the Document Outline (the list on the left). Now the next problem is: how to move the superview after selecting -- arrow keys won't work because I am in the Document Outline! Currently I just go to Size inspector (CMD + ALT + 5), and modify the superview's x & y there.
Anyone got a better method so that the arrow keys work again?
I found a way to do it: after selecting the view in Document Outline, just carefully select it on the canvas by clicking exactly on one of its edges/corners (when the cursor become sizing arrows).
Related
In Xcode 9, an NSPopUpButton is now issuing a warning about 'View is clipping its content'.
The only satisfying settings seems to be to stretch it horizontally through the view (right and left fixed constraints).
This issue is from a clean project with just this popup button added to the Storyboard. In other words, can be recreated easily.
The constraints are top-left simple fixed to superview with the added (since Xcode 9) right 'greater or equal' to superview with constant as 'standard'.
Also, the warning is not a 'yellow' warning. It only shows when opening the 'Issue Navigator' (⌘5).
I'm assuming of course, that popup buttons are not required to grab the whole view length now.
You just need to increase your control size because its contents (NSMenu items which belong to it) are too big to fit inside the NSPopUpButton control.
Your case when you stretched the control to the end of the window satisfied that condition and your control became big enough to contain its contents.
I have an NSOutlineView with the highlight mode set to source list and the menu property set to a non-empty menu (I figured this last consdition is necessary to have the outline drawn).
When I right-click on a row representing an item that has children (i.e., is expandable), The blue outline around the cell has a slightly different color right above and below the disclosure triangle:
(This happens for every node, at every level of the hierarchy)
Additional information: My outline view is view based, does not use bindings (view controller is the delegate and data source).
Me cells are custom, designed on the storyboard, nothing fancy (icon image view and text field).
What can be causing this?
EDIT: The issue only appears with the round-cornerered highlight rectangle of the "Source List" highlight mode. With the straight-cornered rectangle of the "Regular" highlight mode, the stroke color is even all along.
When using the Source List style, your outline view has an NSVisualEffect view behind it, which causes the list to be composited differently. What you're seeing seems to be a bug with the vibrancy appearance. You could perhaps try to work around it by reducing the frame of the outline cell by overriding frameOfOutlineCell.
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.
I'm new to the Dynamic Layout concept introduced in Cocoa applications with Lion 10.7.
I've been playing with some examples and almost all works as I expect. But, there is one thing I've been unable to get: Flexible Height in some elements.
I have one NSTextField element where I can set properly the following constraints:
Leading to trailing -> To keep it "near" to left and right border resizing its width.
Vertical space -> To keep it "near" to the previous vertical element.
I also set:
Vertical space -> To keep it "near" to the bottom border.
Height >= x -> With the previous one, to make its height "flexible" and adjustable to the view's height when resized.
When I test it, it works in the "horizontal axis" (location and size) but it doesn't allow me to resize the window's height (it's fixed).
If I delete the "Vertical space" constraint that attaches the NSInputText to the view's bottom, I can resize the window but the NSInpuntText's height remains unchanged.
Another annoying thing is that the "default" height constraint for the NSInputText (that on "pink" color) can't be deleted or modified. Whenever I do that a new one is created.
Any ideas?
Thanks.
UPDATE
If I use a "Text View" (NSScrollView with a NSTextField inside) instead of a "plain" NSTextField I'm able to create the behavior I want with any problem.
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.