0
私はuibarbuttonitemを持っていますが、initwithcustomviewを使用して初期化しています。私は画像を使って背景を変更したいが、私はやり方を知らない。私はこの画像を使用してuibarbuttonitemの背景を変更する
NSArray *segmentText = [segmentTextMutable copy];
UIImage *image = [[[UIImage alloc] init] autorelease];
image = [UIImage imageNamed:@"bunga.jpg"];
_docSegmentedControl = [[UISegmentedControl alloc] initWithItems:segmentText];
_docSegmentedControl.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_docSegmentedControl.segmentedControlStyle = UISegmentedControlStyleBezeled;
[_docSegmentedControl addTarget:self action:@selector(docSegmentAction:) forControlEvents:UIControlEventValueChanged];
[_docSegmentedControl setBackgroundColor:[UIColor colorWithPatternImage:image]];
のように、setBackgroundメソッドを使用していたが、uibarbuttonitemは、静止画像が表示されない、それだけでセグメント化されたコントロールの背景ではなく、barbuttonを変更です。 誰かが私を助けることができますか?
tintColorに画像を塗りつぶすことはできますか? –