2010-11-30 12 views
1

私はカスタムボタンを描画しています描画:カスタムボタン

UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
myButton.frame = CGRectMake(10,10,44,70); 
[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
[myButton setTitle:@"Order" forState:UIControlStateNormal];     

私はバックグラウンドの色が変化していないボタンをタップしています。通常の状態と選択した状態で異なるイメージを使用する必要がありますか?ここのトリックは何ですか?

[myButton setBackgroundImage:someUIImageRef forState:UIControlStateNormal]; 
[myButton setBackgroundImage:someOtherUIImageRef forState:UIControlStateHighlighted]; 

答えて

2

はい、あなたは異なる状態のために異なる画像を使用する必要があります。 カスタムボタンを使用しているため、すべての単一の状態を手動で記述するか、通常の状態のように表示する必要があります。

+0

うん...私はそれを得た。ありがとう! – Abhinav

関連する問題