I can't set the title of UIButton using IB as center. My title is multi line.It is giving like this one

But I want like this one

I have given space in this but I don't want to do that. As it is not aligned exactly for some cases and I know there is a property of UILabel to set the alignment but I don't want to write a code for that.. just want to set everything from IB.

And if you want to set the text inside the label to the center as well, use:

[labelOne setTextAlignment:UITextAlignmentCenter];

If you want to use IB, I've got a small example here which is linked in XCode 4 but should provide enough detail (also mind, on top of that properties screen it shows the property tab. You can find the same tabs in XCode 3.x):

thanks...but I don't want to set it through IB. :( that's my last option of doing that...
–
Inder Kumar RathoreApr 19 '11 at 8:39

1

@Inder Kumar Rathore: No problem. To set it in IB, you should click on the label, then in the Attributes Inspector, set Alignment to "Center". In my IB (XCode 4), it has 3 icons showing the alignment of text. Obviously, you should pick the middle one then.
–
JoetjahApr 19 '11 at 8:51