uibutton标题
问题描述:
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。
答
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];
但你不能设置背景的对齐方式。
这是什么编程语言? – Sahas 2009-06-08 05:45:08