簡體   English   中英

uibutton標題

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM