ビューのUIButtonの1つでは、通常の状態で使用するイメージを作成しましたが、強調表示/それを行う方法はありますか?または、私は実際に強調表示された/選択されたもののカスタマイズされたイメージを準備しなければならないのですか?UIButtonはハイライトされた状態の標準イメージ/カラーを使用するようにカスタマイズされました
UIButton *shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
[shareButton setFrame:CGRectMake(1.0, 0.0, 99.0, 43.0)];
[shareButton setBackgroundImage:[[UIImage imageNamed:@"share_normal"]
stretchableImageWithLeftCapWidth:0.0
topCapHeight:0.0] forState:UIControlStateNormal];
[shareButton setBackgroundImage:[[UIImage imageNamed:@"share_normal"] // bottom_up_left_3_selected
stretchableImageWithLeftCapWidth:0.0
topCapHeight:0.0] forState:UIControlStateHighlighted];
[shareButton addTarget:self action:@selector(share:) forControlEvents:UIControlEventTouchUpInside];
私は、同じイメージ(通常の状態で使用される)を強調表示された状態に設定することでこれをやってみました。結果は私が欲しいものではなく、代わりにボタンをタップすると色の変化は全くありません。 – tom
あなたはちょうどいくつかのコードを提供できますか? – mashios
私が使用したコードは上記の私の記事をご覧ください – tom