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

iOS: Labels placed in tableview do not exhibit correct behavior when height is Ti.UI.SIZE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: Release 2.0.1
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:
    • Environment:

      iOS 5.1, Appcelerator 2.0.1 GA2

      Description

      Problem Description

      I noticed this behavior in an app I began developing with 1.8 when I upgraded to 2.0. I have a tableview that contains rows which each contain a label. The labels are of varying sizes and may span multiple lines. Sometimes, a label is truncated with ellipses (not the desired behavior). If a few more characters are added, the label displays the entire text (as I would expect) by adding an additional line.

      Actual Results

      The label does not expand to fill two lines and is thus truncated with ellipses.

      BUT, if I change the text of the label and make it SLIGHTLY longer to "I am a label that contains a lot of text.", the label correctly expands to fill two lines and display all of the text.

      Expected Results

      Label should expand if allowed.

      Test Case

      1. Mobile Project
      2. Add this to app.js

      Titanium.UI.setBackgroundColor('#000');
       
      var win1 = Titanium.UI.createWindow({  
          title:'Window',
          backgroundColor:'#fff'
      });
       
      var label1 = Titanium.UI.createLabel({
          color:'#999',
          text:'I am a label that contains text.',
          font:{fontSize:20,fontFamily:'Helvetica Neue'},
          textAlign:'left',
          width: 250,
          height: Ti.UI.SIZE,
          backgroundColor: 'yellow',
      });
       
      win1.open();
       
      tableview = Titanium.UI.createTableView({
          top : 0,
          //left: 0,
          allowsSelection : true,
          width : Ti.UI.FILL,
          height: Ti.UI.FILL,
          data : [],
          style : Titanium.UI.iPhone.TableViewStyle.PLAIN,
          backgroundColor : 'white',
          border: 1,
      });
       
      //win1.add(label1);
      row = Ti.UI.createTableViewRow();
      row.add(label1);
      row.height = Ti.UI.SIZE;
      var data = new Array();
      data[0] = row;
      tableview.setData(data);
      win1.add(tableview);
      

      Extra info

      It should be noted that labels placed directly in a view (not in a tableview) correctly expand to the correct height all of the time when height is set to Ti.UI.SIZE. The unusual and undesired behavior exists only when the label is placed in a tableview.

      (Also, setting the height of the tableviewrow does not effect how the label appears.)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ngupta Neeraj Gupta
                Reporter:
                lukebar Luke Bartolomeo
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration