iPhone UIButton provide different inset values for highlighted state

I want my titleLabel text move a little down on button tap (i.e. I want to give different inset values for highlighted and default states).

I have custom button background images and the button goes down in highlighted state image but the text on it stands at the same place so it gives a bad effect and looks like the text is seperated from button.

Is there any way to solve this?

Thanks in advance


The easiest way to do this is to put your text on the button's background image.

If you can't do that for some reason you can try to add IBAction on Button down and adjust button.titleLabel.frame.

Need Your Help

mysqli fetch_object() throwing an error

php mysql mysqli

Os i'm starting to use mysqli, i'm getting a little confused with how it works.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.