iOS Scrolling - need a cookbook

Graham Samuel livfoss at mac.com
Fri Dec 7 13:17:12 EST 2012


I'm confused about scrolling. I looked at the iOS release notes for LC5.5.3. They say

> Out-of-bounds group scrolling
> 
> Two properties unboundedHScroll and unboundedVScroll now enable you to configure whether scroll values for a group can be set to values outside of the actual content bounds. This makes it much easier to support the standard iOS bouncing features in scrollers.
> 
> This change has been made to both the iOS engine, and the main desktop engine. See the main release notes for more details. 

I can't see anything in the main release notes or the dictionary for that matter, and I can't seem to make the thing work. I realise that I don't know how to deploy this feature at all.

What I'm trying to do right now is to have a group scrolling horizontally across an iPhone portrait screen: the group is wider than the screen (say twice as wide), so I tried to set up a scroller that could show the left-hand side of the group or the right-hand side. I am not so interested in intermediate positions, but they look more native if I allow smooth scrolling. I set the "pageEnabled" of the group to true because I thought I would get the scroll to come to rest either completely on the left or completely on the right. I realise that for this particular case, I could have achieved what I want without a scroller just by using two cards, but the scroller thing is more native and in the end a lot more powerful so I want to make it work.

Lots of strange things have happened when I try stuff out on the simulator (it's the iOS 5 one, as it happens): firstly, when I set "canBounce" to true, the scroller wouldn't come to rest at the left hand side of the frame (the group's rect) but moved away from it leftwards so that part of the left hand side was obscured; same with the right side. So I switched off the bounce effects. Now the scroller will only move a very few pixels, despite the fact that its contentRect is over 600 pixels wide. As a slight aside, but equally annoying, is the fact that the background of the iPhone screen (on the simulator) has turned a rather unattractive grey. I'm pretty sure I haven't set it to grey or any other color.

Fumbling around, I have made scrollers work in the past, but I realise that I don't know what I'm doing, so success has come by luck, mostly. What I need is a nice clear "how to" description of dealing with iOS scrolling. It may well exist, but so far i haven't found it. Can anyone point me in the right direction?

I will keep on experimenting, but some clearly written advice would be a great help.

TIA

Graham




More information about the use-livecode mailing list