Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Implement a UIButton that consisting of left side image & right side text [duplicate]

Possible Duplicate:
UIButton title and image alignment query

I need to implement UIButton show in below image

please help me how to implement

Thanks, Prasad

enter image description here

like image 681
Prasad Avatar asked Sep 07 '11 07:09

Prasad


1 Answers

Have a look to the titleEdgeInsets property of UIButton.

@property(nonatomic) UIEdgeInsets titleEdgeInsets

Use the below approach to get both with the UIButton .

[myButton setImage: [UIImage imageNamed:@"settingImage.png"] forState:UIControlStateNormal];
[myButton setTitleEdgeInsets:UIEdgeInsetsMake(100.0, -100.0, 10.0, 15.0)];
[myButton setTitle:@"settings" forState:UIControlStateNormal];
like image 77
Jhaliya - Praveen Sharma Avatar answered Nov 15 '22 07:11

Jhaliya - Praveen Sharma