iDevGames Forums
find the rect.size.height that contains nsstring given the rect.size.x - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: find the rect.size.height that contains nsstring given the rect.size.x (/thread-10172.html)



find the rect.size.height that contains nsstring given the rect.size.x - sefiroths - Jul 13, 2012 10:00 AM

i'd like to make a popup that has dimension size.y variable and size.x fixed.
there is a method that find how much must be the y that contains all the text?
thanks


RE: find the rect.size.height that contains nsstring given the rect.size.x - SethWillits - Jul 13, 2012 12:11 PM

I assume it's a custom popup…

At any rate, to find the height of a string, use NSAttributedString's boundingRectWithSize:options: method, with the option NSStringDrawingUsesLineFragmentOrigin, and size {fixedWidth, maxHeight}