2013-03-21 2 views
0

이 게시물 (UIButton: Add gradient layer and title is not shown anymore - how to fix?)과 비슷한 문제가 있지만 그의 솔루션이 저에게 효과적이지 않습니다. 먼저, MonoTouch에 다소 익숙하지만, 상자 컨트롤을 사용자 정의하는 일은 결코 없었습니다.MonoTouch UIButton 그라디언트 커버 제목

내 단추에 그라디언트를 추가하려고하는데 그라디언트가 원하는대로 정확하게 보이지만 텍스트가 덮여 있습니다 (그라디언트의 불투명도를 테스트하려면 .5로 설정 함). 인터페이스를 시각적으로 디자인 한 스토리 보드가 있지만 몇 가지 사항을 조정하고 싶습니다.

여기 내 코드입니다 :

var gradient = new CAGradientLayer(); 
gradient.Frame = getStartedButton.Layer.Bounds; 
gradient.Colors = new MonoTouch.CoreGraphics.CGColor[] 
{ 
    UIColor.FromRGB (23, 55, 94).CGColor, 
    UIColor.FromRGB (33, 81, 141).CGColor 
}; 

getStartedButton.Layer.AddSublayer(gradient); 
getStartedButton.Layer.CornerRadius = 10; 
getStartedButton.Layer.BorderColor = UIColor.White.CGColor; 
getStartedButton.Layer.BorderWidth = 1; 

getStartedButton.VerticalAlignment = UIControlContentVerticalAlignment.Center; 
getStartedButton.Font = UIFont.FromName("Helvetica", 12); 
getStartedButton.SetTitleColor(UIColor.White, UIControlState.Normal); 

getStartedButton.SetTitle("Get Started", UIControlState.Normal); 

답변

1

당황하지만, 단순히 엑스 코드에서 사용자 정의 버튼의 종류를 변경하는 문제였다.