[英]uibutton title
UIButton *ticketButtonObj=
[[UIButton alloc]initWithFrame:CGRectMake(140.0f 100.0f, 390.0f, 40.0f)];
UIImage *buttonicon1=[UIImage alloc];
buttonicon1=[UIImage imageNamed:@"Generalticket.png"];
怎樣才能將buttoniconObj的背景與buttonicon1 ..設置為左對齊?
請幫我...謝謝拉朱的問候。
UIButton *ticketButtonObj = [[UIButton alloc] initWithFrame:CGRectMake(140.0f 100.0f, 390.0f, 40.0f)];
UIImage* buttonicon1 = [UIImage imageNamed:@"Generalticket.png"];
[ticketButtonObj setImage:image forState:UIControlStateNormal];
ticketButtonObj.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
或者,如果您想設置背景圖片:
[ticketButtonObj setBackgroundImage:image forState:UIControlStateNormal];
但是您不能為背景設置對齊方式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.