2010-03-23 3 views
4
// Make text white... and background blue 

[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
[myButton setBackgroundColor:[UIColor blueColor]]; 

흰색 텍스트와 파란색 배경의 단추를 만들어야합니까? 그렇지 않습니다.흰색 텍스트가있는 파란색 버튼을 만드는 방법은 무엇입니까?

+1

그래서 어떻게됩니까? – stefanB

+0

텍스트가 전혀없는 버튼처럼 보입니다. 버튼의 * 코너가 파란색으로 변합니다. – Susanna

답변

0

버튼이란 무엇입니까? 그러면 색상 설정에 따라 모양이 달라집니다. 옳은 것을 찾을 때까지 다른 단추 스타일을 시도해보십시오.

3

버튼 모양이 UIButtonTypeRoundedRect 인 것 같습니다. 아래 링크는 귀하의 질문에 대한 답변입니다.

Is it even possible to change a UIButtons background color?

내가 그러나 할 것은 단지 그것을 유형을 제공하지 않습니다.

UIButton *myButton = [[UIButton alloc] init]; 
[myButton setBackgroundColor:[UIColor blueColor]]; 
[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 

그래도 그렇게 멋지게 보이지 않습니다.