Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2220] iOS: ScrollableView doesn't work on first display (change from 1.4.1.1 to 1.5)

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-07-13T09:53:19.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsapi
Reporterchris
AssigneeNeeraj Gupta
Created2011-04-15T03:13:52.000+0000
Updated2017-03-09T22:45:34.000+0000

Description

I have an iPhone app that uses a ScrollableView with usually 3 ImageView's as its views. In 1.4.1.1 it works great. But, in at least the two 1.5.0 builds I've tried, the scrollability just doesn't work. The view appears to be there, as I see the paging control at the bottom, but I can't scroll amongst my views. I've tried adding the views in a variety of ways (create views first, add as array when creating ScrollableView, add after creation, with scrollable.addView, with scrollable.setViews, etc.). The KitchenSink's ScrollableView doesn't seem to suffer from this.

I figured since this works in 1.4.1.1, but not in 1.5 that's a change, and thus potentially a bug. Below is how I'm creating the ScrollableView. One additional note is that I now have to explicitly set the top and height values on the ImageViews, otherwise it seems to center them in the scrollview (and thus they overlap the paging control a bit):

    win = Ti.UI.createWindow({
      backgroundColor: '#000',
      barColor: '#000',
      translucent: true,
      tabBarHidden: true,
      backButtonTitle: 'Back',
      title: hotel.name
    });
    scrollView = Ti.UI.createScrollableView({
      views: photos.map(function(photo) {
        return Ti.UI.createImageView({
          image: photo,
          backgroundColor: '#000',
          top: 0,
          height: 460
        });
      }),
      backgroundColor: '#000',
      showPagingControl: true,
      pagingControlHeight: 20,
      bottom: 0,
      height: 480
    });

    win.add(this.scrollView);

Comments

  1. chris 2011-04-15

    Note, as you may have guessed, the above code is extracted out of mine, as is part of a class, etc. So, the last line should really be "win.add(scrollview)" to be a bit more accurate.

  2. Stephen Tramer 2011-04-15

    Actually, this now causes a crash.

       win = Ti.UI.createWindow({
             backgroundColor: '#000',
             barColor: '#000',
             translucent: true,
             tabBarHidden: true,
             backButtonTitle: 'Back',
             title:"fuuuuu"
           });
           var views = [];
           for (var i=0; i< 10; i++) {
               views[i] = Ti.UI.createImageView({
                 image: 'images/flower.jpg',
                 backgroundColor: '#000',
                 top: 0,
                 height: 460
               });
           }
           scrollView = Ti.UI.createScrollableView({
             views:views,
             backgroundColor: '#000',
             showPagingControl: true,
             pagingControlHeight: 20,
             bottom: 0,
             height: 480
           });
       
           win.add(scrollView);
           win.open();
       
  3. Tamas Daniel 2011-04-15

    I can confirm the issue appears when you try to use views in constructor even for 1.7.0

    An workaround is to add the views after you build the scrollableView.

  4. Sabil Rahim 2012-07-13

    The issues to seems not exist in the latest master Tried reproducing the issue on iPhone Sim 4.3 , 5.0 and 5.1 and on Device iPhone 3GS running 5.1 Testing Environment Mac OSX 10.7.3 Xcode 4.3 Sim 4.3, 5.0, 5.1 Device iPhone 3GS (5.1) SDK Build: 2.2.0, githash ac2ec17(master on July 13, 2012) Marking ticket as cannot reproduce.
  5. Lee Morris 2017-03-09

    Closing ticket as the issue cannot be reproduced.

JSON Source