Programmatically set image and text on UIButton

You've made a mistake there, you're doing

[btn setBackgroundImage:buttonImage forState:UIControlStateNormal]; 

instead of

[btn setImage:buttonImage forState:UIControlStateNormal]; 

This will work fine.


UIButtons setImage sets the image above the title so you will not be able to see the text below it. So try to set image to your button with setBackgroundImage.

Objective-C:

[btn setBackgroundImage:buttonImage forState:UIControlStateNormal]; 

Swift:

myButton.setBackgroundImage(buttonImage, forState: .normal)