How to set the title as left alignment in the UIButton.

Posted by Madan Mohan on Stack Overflow See other posts from Stack Overflow or by Madan Mohan
Published on 2010-05-04T11:56:19Z Indexed on 2010/05/04 12:18 UTC
Read the original article Hit count: 559

Filed under:
|

Hi Guys, I need to dispaly the email address from left side of a UIButton, But it is getting in the center. Is there any way to set the alignment to the left side of a UIButton.

UIButton* emailBtn = [[UIButton alloc] initWithFrame:CGRectMake(5,30,250,height+15)];
                emailBtn.backgroundColor=[UIColor clearColor];
                [emailBtn setTitle:obj2.customerEmail forState:UIControlStateNormal];
                emailBtn.titleLabel.font = [UIFont systemFontOfSize:12.5];
                [emailBtn setTitleColor:[[[UIColor alloc]initWithRed:0.121 green:0.472 blue:0.823 alpha:1]autorelease] forState:UIControlStateNormal];
                [emailBtn addTarget:self  action:@selector(emailAction:)  forControlEvents:UIControlEventTouchUpInside];
                [elementView addSubview:emailBtn];
                [emailBtn release];

Please help me. Thank You, Madan Mohan.

© Stack Overflow or respective owner

Related posts about uibutton

Related posts about objective-c