Solskjaer
Solskjaer

Reputation: 175

How can i set the title of UIButton in front of the UIButton image

I use [button setImage:image forState:0]; to set a image to a UIButton.

Then I want the title of it using [button setTitle:[titleArray objectAtIndex:i] forState:0];.

But the image cover the title which I want to show in front of the image.

Any solution?

Thanks!

Upvotes: 0

Views: 840

Answers (1)

TomSwift
TomSwift

Reputation: 39502

use setBackgroundImage:forState instead. When you use the (foreground) image, you dont get to set a title.

Upvotes: 3

Related Questions