2009-06-08 5 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"]; 

어떻게 buttonicon1과 함께 ticketButtonObj의 배경을 왼쪽 정렬로 설정할 수 있습니까?uButton 제목

pls ... 도와 주셔서 감사합니다.

+0

어떤 프로그래밍 언어입니까? – Sahas

+0

Mac 또는 iPhone에서 Objective-C를 추측하고 있습니다. – Tim

+8

@ Raju - 24 개 질문을했으며 그 중 누구도 대답을 수락하지 않았습니다. 질문을 검토하고 유용한 답변을 제공 한 사람들에게 보상하십시오. 앞으로도 계속 진행될 것 중 하나입니다. – diciu

답변

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

을하지만 배경에 대한 정렬을 설정할 수 없습니다.