简体   繁体   中英

add text in a button with image? objective-c

how would you write some text in a UIButton that already contains an image? i'd like to have a button like "save", but i also have an image that is the "button", so i put a UIButton on the view in IB, then either text first or image first, the text never shows up in front of the image. How would you do that?

Thanks !

Create a UILabel with the text you need, then add it as a subview to your UIButton . You can do that programmatically in the -viewDidLoad function of the view containing your UIButton s.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM