Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19523

IOS: ImageView within ListView with defaultImage set is not resized accordingly to remote image

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:

      Description

      I have a listview, which displays remote images of different dimensions. While images are loaded, I show defaultImage with spinner.
      Here's a template I have for this

      template

      {
          bindId: 'main',
          properties: {height: Ti.UI.SIZE},
          childTemplates: [
              {
                  type: 'Ti.UI.ImageView',
                  bindId: 'image',
                  properties: {
                      width: Ti.UI.SIZE,
                      height: Ti.UI.SIZE,
                      defaultImage: 'icon_spinner_wide.png'
                  }
              }
          ]
      }
      

      Once list is displayed, default image is shown, and ImageView has height and width according to default image. The problem is that as soon as remote image is loaded (and cached), it is displayed, but the height remains same as it was for default image. If I open the list 2nd time, it works fine, because the image is not remote anymore and could be shown immediately, without default image.

      I've tried to add event listener to 'load' event for image (in order to adjust list item height), so template looks like this:

      imageview+loadhandler

      type: 'Ti.UI.ImageView',
      bindId: 'image',
      properties: {
          width: Ti.UI.SIZE,
          height: Ti.UI.SIZE,
          defaultImage: 'icon_spinner_wide.png'
      },
      events: {
          load: function(e) {
              alert('hello');
          }
      }
      

      but unfortunately as soon as 'load' event handler is declared, I get following error on listview.setSections:

          • setObjectForKey: object cannot be nil (key: section)
            If I add handler for click event, it works. Probably these 2 issues are connected.
            Also it works on Android (both resize after remote image is loaded and load event).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                apetkov Angel Petkov
                Reporter:
                lees_oz Lev
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-20354
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code