Thus, I seem to encounter some weird behavior when using NSString -sizeWithFontmethod call families depending on whether I call it on the iPhone Simulator or the actual device.
Simple enough, when the receiver of the method call -sizeWithFont:constrainedToSize:lineBreakMode: nil, the resultant CGSize, passed back to the simulator, is equal {0, 0}. However, on the device, the return result is the same value CGSizethat I specify in the method call as a parameter constrainedToSize:. See the following log statements:
Simulator:
someString: (null)
someStringSize: {0, 0}
Device:
someString: (null)
someStringSize: {185, 3.40282e+38}
The behavior on the Simulator is what I would expect. It's not that this question is hard to get around, but 1) I'm a bit confused, why does this family of functions behave differently on the Simulator and the actual device, and 2) why does calling the method in the receiver nilreturn a specific, deterministic result?
Thanks for any pointers or insights that you guys can provide!
EDIT . I believe that I should mention that I am building against the 3.1 SDK.
source
share