ScrollView Doesn't Scroll the First Time Window is Opened

You must Login before you can answer or comment on any questions.

Hi,

I have a window which gets a couple sets of data from ACS and renders them in a semi-complex layout (table view + some other stuff) all inside a scroll view. The problem is that when I first open this window the scroll view with everything in it is frozen -- the touch events for its children work but it won't scroll. But if/when I go back to another window and then reopen the one with the scrollview everything works as intended.

Either I'm doing something wrong or this is a bug. In either case I need to figure out a fix/workaround. I appreciate any input.

Thanks.

— asked 7 months ago by Stoyan Vasilev
3 Comments
  • Hi Stoyan. We need: TiSDK version, Android/IOS version, logs (if there's any errors/warnings). Is it possible for you to create a simple test case which reproduces it? Or is your layout too complex? I'd try creating a simple version of your scroll view situation and keep adding in content until you reproduce it... We don't really have a way of knowing what your problem is without anything to work with. Cheers.

    — commented 7 months ago by Daniel Sefton

  • Hi,

    This is Ti SDK 2.1.3 and it is happening in both the iOS Simulator and on my 4th Gen iPod Touch test device. Running XCode 4.5 with iOS6.

    The data pull/processing and the way the layout comes together is relatively complex. I was hoping that this is something that's happened to other people before, so that I don't have to do the incremental rebuild to discover the part that triggers this behavior. If I go through the process, I will likely solve the problem without any help from the community. :)

    Thanks.

    — commented 7 months ago by Stoyan Vasilev

  • Once I locate the part that triggers this I will post it here.

    — commented 7 months ago by Stoyan Vasilev

1 Answer

Accepted Answer

Hi,

I figured out how to make this work. To contextualize this the code inside my CommonJS module for this view runs like this:

1) Create and add window and scroll view at the top of the module. These are just in the body of the module (not part of the constructor function which initializes it).

2) Constructor function (run when the module is initialized) which pulls a bunch of reviews (each one filled with a lot of custom fields) associated with a place from ACS.

3) ACS callback which processes the reviews, creates a table view with a single section, and adds all reviews as rows.

4) Callback from #3 which pulls the above mentioned place from ACS.

5) ACS callback which renders part of the place data inside the scroll view, attaches the tableview from #3, and then renders the rest of the place data.

The thing that fixed my problem was changing "contentHeight: 'auto'" to "contentHeight: 895" for the scroll view from #1 above.

Now that I look back on this it sort of makes sense that this was the problem -- scrollview could not guess the height of its contents -- at the same time I don't know what happens behind the scenes when my module is executed and could have only guessed that this would be a problem.

If anyone here has clues on how the sequence of code inside my module translates into a instructions for iOS to execute, please share.

Your Answer

Think you can help? Login to answer this question!