uibutton标题

时间:2009-06-08 05:43:03

标签: iphone uibutton

UIButton *ticketButtonObj=
    [[UIButton alloc]initWithFrame:CGRectMake(140.0f 100.0f, 390.0f, 40.0f)];   
UIImage *buttonicon1=[UIImage alloc];
buttonicon1=[UIImage imageNamed:@"Generalticket.png"];

如何在左对齐中用buttonicon1 ..设置ticketButtonObj的背景?

请帮助我... raju的感谢和问候。

1 个答案:

答案 0 :(得分: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];

但是你无法设置背景的对齐方式。

相关问题