는 다음 코드를 사용하여 버튼의 색상을 변경 :IOS : 변경 버튼 색상
[self.testButton setBackgroundColor:[UIColor redColor]];
을하지만 난 이상한 버튼을 가지고 :
버튼의 배경색을 변경하지 않은 이유 ? 당신은 #import <QuartzCore/QuartzCore.h>
을 가져오고이 시도 할 수
는 다음 코드를 사용하여 버튼의 색상을 변경 :IOS : 변경 버튼 색상
[self.testButton setBackgroundColor:[UIColor redColor]];
을하지만 난 이상한 버튼을 가지고 :
버튼의 배경색을 변경하지 않은 이유 ? 당신은 #import <QuartzCore/QuartzCore.h>
을 가져오고이 시도 할 수
,
self.testButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.testButton.backgroundColor = [UIColor redColor];
self.testButton.layer.borderColor = [UIColor blackColor].CGColor;
self.testButton.layer.borderWidth = 0.5f;
self.testButton.layer.cornerRadius = 10.0f;
아니면이 버튼의 배경 이미지로 일부 사용자 지정 이미지를 사용할 수 있습니다.
변경하여 .xib에서 속성 관리자의 사용자 정의에있는 버튼 타입은 다음 버튼 자체가 다른보기입니다 단지이다, 코드
[self.testButton setBackgroundColor:[UIColor redColor]];
버튼 배경이 변화했다 보십시요. – CodaFi
testButton 스타일을'UIButtonTypeCustom'로 설정하고 확인하십시오. 붉은 색으로 표시되어야합니다. – iDev