views:

90

answers:

1

I want to display an image next to a UILabel, however UILabel has variable text length, so I don't know where to place the image. How can I accomplish this?

+4  A: 
CGSize expectedLabelSize = [yourString sizeWithFont:yourLabel.font 
                        constrainedToSize:maximumLabelSize 
                        lineBreakMode:yourLabel.lineBreakMode]; 

http://stackoverflow.com/questions/455553/what-is-nsstring-sizewithfontforwidthlinebreakmode-good-for

this question might have your answer, it worked for me.

Aaron Saunders