Xcode invisible elements - xcode

I don't know what happened. Elements items like buttons or segmented control are invisible in main storyboard. Cellphone is the same.
I put the image, of what I mean

It looks like you accidentally changed the view's (or window's) Tint Color to white. (Or you could even have turned it to Clear color, or no color at all.)
This would cause the text of the button or segmented control to be invisible, because it is white on white. The segmented control has a border but it would turn white too. So you wouldn't be able to see anything.
There are two places to look to fix this. Look at the Tint popup of your view controller's View in the Attributes inspector.
Also look at the Global Tint popup in the File inspector for the whole storyboard.
[EDIT It turned out to be the Global Tint.]

Related

NSOutlineView - Disclosure Triangle Interferes with Highlight Rectangle

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.

NSPopupButton with color well

Some of the color selection buttons in the Xcode details panels are a NSPopupButton with a color well. It looks something like a segmented control/popup button.
Placing a standard color well and standard popup button next to each other doesn't have the same look. Also, the menu wouldn't cover the color well in this case. The popup image (two triangles) is not readily available for a custom control either.
Anyone tried to make a similar control before? Any hints on how to make it?

Why does the default background of the uivew is black in IB xcode?

When i set the default background for the view (the view is used as a header for the table) in IB it becomes black but when I run the app on a simulator it has the default color of the uitableview background.
When i set the default color to yellow for example it is always yellow for both IB and simulator.
why the default background color is black in IB and gray with stripes in a simulator?
Because the Interface Builder in Xcode has bugs. I assume you mean you are setting the background color to the "default" option?
I have run into several similar bugs with background color, sometimes it even sets the background color of an element that isn't supposed to have a background color. What I usually do is right click on the xib or storyboard file and Open As Source Code. Then find my element and carefully delete the background property (make a backup of the file if you are concerned about accidentally breaking the complex xml file structure). Then open it as Interface Builder again and it usually figures things out.
Or, worst case, I delete the problem element or view and recreate it.
Edit: it also occurred to me that the default color could be the clear color, in which case, the texture is showing through the view, not being drawn as the view's background, and interface builder chooses black because A) it doesn't know what the view will be drawn on top of and/or B) the view or parent view is marked as opaque or something to that effect.

Making an NSButton resize its image (Cocoa OSX)

I could not find a way in the documentation to tell an NSButton to resize its image to fill up the whole button. Is there a way to do this programatically?
The closest you'll get is -setImageScaling: ... look up the constants to see how the image will be scaled within the button cell, given its bordered state and bezel type.
If you're looking to replace the standard button entirely with your image (ie, the button cell doesn't draw itself at all - your image serves as the entire visual representation), turn off the border (-setBordered:).
All of these options can be configured in IB as well. A tip: in IB, hover the mouse over any setting in the inspector panel - most if not all give you a hint that shows what method controls the behavior affected by the setting's control.

How can I change the way NSButtonCell objects highlight when clicked?

I am using several NSButtonCell objects in an NSTableView. They are simple square buttons with custom images on them.
These buttons draw properly when they are not highlighted: all that is visible is the image, and the rest of the button rectangle is transparent. However, when I click on them, the entire button rectangle is highlighted, inverting the background in the parts that were transparent.
I would prefer to see the image drawn inverted, and the transparent parts remain transparent. How can this be done?
Try setting your cell's highlightsBy property to NSContentsCellMask. I think you'll have to do this in code (probably in awakeFromNib); I don't see a way to do it in IB alone.
You can do it in Interface Builder too. I use "Square Button" so the button alters between two images (so the image is not inverted at all).
Your buttons behaviour is probably set to "Momentary Light" or "Momentary Push In".
Set the Behaviour to "Momentary Change", and it should work.

Resources