私は目的のアプリケーションにUIButtonを持っています。私のボタンは同様にテキストや画像を追加する修正されました:imageEdgeInsetsを使用してUIButtonでイメージのtintColorを変更するにはどうすればよいですか?
- (void)centerButtonAndImageWithSpacing:(CGFloat)spacing {
CGFloat insetAmount = spacing/2.0;
self.imageEdgeInsets = UIEdgeInsetsMake(0, -insetAmount, 0, insetAmount);
self.titleEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, -insetAmount);
self.contentEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, insetAmount);
}
そして私は、このコードで画像を追加します、私は画像のtintColorを変更したい
[self.myButton setImage:[UIImage imageNamed:@"imageButton.png"] forState:UIControlStateNormal];
が、私はこれを変更しようとすると、私のコードは動作しません。
[self.myButton setTintColor:[UIColor redColor]];
を、私はこのコードを使用しようとしているが、うまくいきませんでした:

がどのように私はIMAGEBUTTONの色を変えることができる:私はそれを取得したい
:10
私はこれを持っていますか?
このリンクを参照してください。http://stackoverflow.com/questions/12396236/ios-change-the-colors-of-a -uiimage –