を隠します。ボタンのタイトルは、私のボタンのタイトルを画像に重なっ..私はボタンのタイトルと画像の両方を設定しています..しかし、私は問題に直面していますボタン画像のiOS
私のコードでは、画像の背景に画像を設定する方法
-(void)addImageonbtn:(UIButton *)Button{
[Button setImage:[UIImage imageNamed:@"drop_bg"] forState:UIControlStateNormal];
Button.imageEdgeInsets = UIEdgeInsetsMake(0, Button.frame.size.width, 0, 24);
Button.titleEdgeInsets = UIEdgeInsetsMake(0, -37, 0, 0);
Button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft ;
Button.layer.borderWidth=1;
Button.layer.borderColor=[UIColor colorWithRed:5/255.0 green:195/255.0 blue:249/255.0 alpha:1.0].CGColor;
Button.clipsToBounds=YES;
}
をあなたに合う必要がありますUILabelとUIImageViewを持つコンポーネントを作成する必要があります。ここではUILabelの幅をUIImageViewの開始Xに制限しますが、重複しません。 – iphonic