In one of my apps I have a detail view where I display lengthy text articles. This morning I discovered that on an older iPhone 4 my long text does not completely show. Newer devices are all fine. Some investigation led me to the API page for display.newText() which says the following for multi-line text display :
Setheight to 0 and the text box height will adjust to the amount of text, but never exceed the maximum texture height for the device.
This should really be a Gotcha as it does get you!!! Just found out that a text display which works perfectly on newer devices get chopped in the middle on older devices. No alert no warnings… Just gets chopped.
So this being the case, I’m thinking I will have to do the following :
-
determine the “maximum texture height” for the device which my app is running on
-
chop my text into smaller pieces and create multiple display.newText() calls such that each one of them fall under the “maximum texture height”.
-
insert the multiple display.newText() objects into the scrollview such that they all look and feel as one text body scrolling up & down together.
Questions :
a) How can I determine the “maximum texture height” for a given device at runtime?
b ) Is the approach I describe above viable? I worry that other components, ie scrollView might also be affected by the “maximum texture height”. Any other gotchas you can think ok?
c) Is there anyway to know if the display.newText() call succeeded in showing the whole text given to it or not? It doesn’t look like there is a function return on this API and I strongly wish there was! I think if the display.newText() can’t do what its asked to do due to the device limitation then it should return a result code telling us that it had to chop the text and also tell us the position up to where it could display the text. This would make it so much easier to deal with this unpleasant situation.
Any thoughts, ideas, suggestions and hints will be most appreciated. Wishing you all a great weekend.
Regards,
Kerem
