문제

I have a button in the storyboard, I gave it a color magnesium. I am doing some programming on the button which will change its color on certain situations.

I like the original color of the button in the storyboard and I want to return back to that color at some event.

Now the problem is that color I am using doesn't have a text name (yellowcolor, purplecolor) in UIColor and I can't find the RGB values from the storyboard color picker.

Any ideas?

도움이 되었습니까?

해결책 2

Xcode->Select Object->Attributes Inspector->Text Color->Other->Color Sliders->Dropdown Menu->RGB Sliders

다른 팁

Follow this screen shot. I am on Windows 8 right now so i just edited the picture but it will certainly give you the way to achieve what you want.

(I combined two DIFFERENT images. So don't freak out. Sorry.)

enter image description here

You can do this to get the RBG from UIColor:

CGFloat red = self.btn.backgroundColor.CIColor.red;
    CGFloat blue = self.btn.backgroundColor.CIColor.blue;
    CGFloat green = self.btn.backgroundColor.CIColor.green;
    CGFloat alpha = self.btn.backgroundColor.CIColor.alpha;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top