Bring up Color Palette - cocoa

How can I create an action so when a button is clicked the Apple color palette window appears? I do not want to use an NSColorWell.
Thanks!

Do you mean the color panel? There's a method orderFrontColorPanel in the Application place holder in IB -- just connect that to your button.

Related

How to set color for a button in Xcode7?

Hi Im new to Xcode7 and Swift2 and I am trying to change the color of the buttons I am adding to my storyboard. Is there a way to change the color of the button in Xcode7? All I see are options to change color of text and add background image to a button but no change button color.
A button has many parts / aspects, so what do you mean by the "button color"? You probably mean the button's background color. If you scroll down in the button's attributes inspector, you'll come to the background color. The reason it's so far down is that it's a View (UIView) property, not merely a button (UIButton) property.

How to set RGB color for UILabel in Interface Builder?

I know this can be done programmatically. But I wonder if there's a way to do this in Interface Builder, where I can see how the color looks without launching the app?
In Xcode with your UILabel selected, go to the properties panel. Double click on the color property, when the color selector window pops up, select the second tab (sliders).
There is a drop down box that you can select what type of slider you want RGB Slider is one of the options. When you select your color, simply drag it into the color property box.

XCode Interface Builder Background color

I'm a newby in XCode/iOS development, and I want to change bakckground color of my label (XCode 5.0):
Opened my storyboard
Chose my label on the left side
Opened attributes inspector on the right side
But this tab has got settings of font, alignment, but no background color options! There is "View" section at the bottom, but it is empty. Please, tell me where can I find settings of background color? Thanks
At the top select the attributes inspector. Under the section "View" there should be a spot that says "Background". click that and choose your colour.
(refer to image for help)
Select the Label click on "Attribute Inspector" and scroll down you will see background option under View Section.
Select label before you go to Attribute Inspector
mylabel.backgroundColor = [UIColor redColor] ; is the code to change the background color. You get the color name before "Color" from the names of colors in the Apple color palette.

How to change the style of the window close/minimize/resize buttons in Cocoa?

In a standard Cocoa window, is it possible to change the colors of the close, minimize, and resize window buttons from the textured, glossy, gumdrop style to a simple red, yellow, and green color with no gradient/gloss?
There's no built-in way so you've gotta do your own custom drawing.
Check out How to draw custom window controls (close, minimize, and zoom buttons) for an example.
No. But you can create a custom borderless window and create buttons if your liking and connect them to the same actions.

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.

Resources