Scrolling a very large image on iOS
gerry.orkin at gmail.com
Wed Nov 27 09:55:58 CET 2013
Dear LiveCode hive mind
I have an image that is 55000 pixels wide by 1250 pixels high. It contains 44 square photographs, evenly spaced across the image. The image is an imported jpeg that is about 9.5mb on disk.
I’m scrolling it in a native iOS scroller that is 1250 x 1250 pixels. Paging is set to true (so as the user swipes the image snaps into position) - the scrolling group and image are positioned correctly so that swipes across the image positions each photograph correctly as the user swipes back and forth. As the image snaps into position, I grab the hScroll of the scroller and display it in a field.
The scrolling group has it’s layer mode set to scrolling. The large image within the group has it's layermode set to dynamic. On preopencard I’m setting acceleratedrendering to true and the compositorType of the stack to “OpenGL".
Works well on an iPad 3…until I reach position 26 (hScroll = 32502). If I try to scroll to position 27 the image disappears (on both the device and the simulator). The scroller keeps working, however - if I keep scrolling I can see the hScroll value going up. And when I scroll back to position 26…the image re-appears.
I’m thinking this is a memory problem. Is there any way I can improve the performance of this scroller (besides reducing the quality of image)?
More information about the use-livecode