I am having an issue while i try to create a UIButton with the following options: title aligned to left and image aligned on right,
I want to do it programatically, here is what i tryed so far, it works but not like i want to
UIButton *definition_title = [UIButton buttonWithType:UIButtonTypeRoundedRect];
definition_title.frame = CGRectMake(0,0, accordion.frame.size.width, 70.0f);
[definition_title setImage:[UIImage imageNamed:@"image_name.png"] forState:UIControlStateNormal];
definition_title.imageEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10);
definition_title.imageView.contentMode = UIViewContentModeScaleAspectFit;
[definition_title setTitle:@"Scan the Barcode" forState:UIControlStateNormal];
definition_title.titleEdgeInsets = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f);
definition_title.imageEdgeInsets = UIEdgeInsetsMake(0.0f, accordion.frame.size.width-50, 0.0f, 0.0f);
definition_title.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
the code above returns i Uibutton like this
________________
| text image|
but i want it like this
________________
|text image|