2009-06-08 110 views
0
UIButton *ticketButtonObj= 
    [[UIButton alloc]initWithFrame:CGRectMake(140.0f 100.0f, 390.0f, 40.0f)]; 
UIImage *buttonicon1=[UIImage alloc]; 
buttonicon1=[UIImage imageNamed:@"Generalticket.png"]; 

如何設置ticketButtonObj的背景與buttonicon1 ..左對齊?uibutton標題

請幫助我...感謝和問候raju。

+0

這是什麼編程語言? – Sahas 2009-06-08 05:45:08

回答

3
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]; 

但你不能設置背景的對齊方式。