Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10564] iOS: Cannot dynamically resize a View inside a TableViewRow

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-05-06T08:34:41.000+0000
Affected Version/sRelease 2.1.1
Fix Version/s2013 Sprint 09
ComponentsiOS
Labelscore, layout
ReporterDavide Cassenti
Assigneejithinpv
Created2012-08-22T16:11:38.000+0000
Updated2017-03-23T19:03:40.000+0000

Description

Problem description

When a View is child of TableViewRow, it becomes impossible to resize it dynamically. Parameters width and height are actually changed, but the view inside the app does not change.

Steps to reproduce

1. Test out this app:
// make a window to test in
var win = Ti.UI.createWindow( { backgroundColor: 'white' } );
win.open();



// WINDOW VIEW (works)
var wView = Ti.UI.createView( {
    backgroundColor: 'yellow',
    width: 150,
    height: 150,
    top: 25
} );
win.add( wView );
var wViewToggle = false;
wView.addEventListener( 'click', function () {
    wViewToggle = !wViewToggle;
    if ( wViewToggle ) {
        wView.backgroundColor = 'blue';
        wView.width = 100;
        wView.height = 100;
    } else {
        wView.backgroundColor = 'yellow';
        wView.width = 150;
        wView.height = 150;
    }

    Ti.API.info( 'wView.width = ' + wView.width );
    Ti.API.info( 'wView.height =  ' + wView.height );

} );



// TABLE VIEW (broken)
var table = Ti.UI.createTableView( {
    top: 200
} );
win.add( table );
var row = Ti.UI.createTableViewRow( {
    backgroundColor: 'red',
    selectionStyle: 'none',
    height: Ti.UI.SIZE
} );
table.data = [ row ];
var tView = Ti.UI.createView( {
    backgroundColor: 'yellow',
    width: 200,
    height: 200
} );
row.add( tView );
var tViewToggle = false;
tView.addEventListener( 'click', function () {
    tViewToggle = !tViewToggle;
    if ( tViewToggle ) {
        tView.backgroundColor = 'blue';
        tView.width = 100;
        tView.height = 100;
    } else {
        tView.backgroundColor = 'yellow';
        tView.width = 150;
        tView.height = 150;
    }

    Ti.API.info( 'tView.width = ' + tView.width );
    Ti.API.info( 'tView.height =  ' + tView.height );

} );
Clicking on the squares, the result should be a resize of the view; while the square on top works (view is inside the window), the second does not (view inside tableviewrow).

Comments

  1. Omri Shaked 2013-03-06

    Another code example that reproduces:
       var win = Ti.UI.createWindow({
       	backgroundColor : "white"
       });
       
       var tableView = Ti.UI.createTableView({
       	height : "100%",
       	width : "100%",
       	backgroundColor : "transparent",
       	separatorStyle : Titanium.UI.iPhone.TableViewSeparatorStyle.NONE,
       });
       
       var row = Ti.UI.createTableViewRow({
       	height : Ti.UI.SIZE,
       	selectionStyle : Titanium.UI.iPhone.TableViewCellSelectionStyle.NONE,
       });
       
       var externalView = Ti.UI.createView({
       	height : Ti.UI.SIZE,
       	width : "100%",
       	top : 20,
       });
       
       var middleView = Ti.UI.createView({
       	height : Ti.UI.SIZE,
       	width : "100%",
       	top : 0,
       });
       
       var innerView = Ti.UI.createView({
       	height : 50,
       	width : "100%",
       	top : 0,
       	backgroundColor : "red",
       });
       
       middleView.add(innerView);
       externalView.add(middleView);
       row.add(externalView);
       tableView.data = [row];
       win.add(tableView);
       
       win.open();
       
       setTimeout(function() {
       	innerView.height = 200;
       }, 5000);
       
       setTimeout(function() {
       	Ti.API.info("==============================");
       	Ti.API.info("Inner view height   : " + innerView.size.height);
       	Ti.API.info("Middle view height  : " + middleView.size.height);
       	Ti.API.info("External view height: " + externalView.size.height);
       	Ti.API.info("==============================");
       }, 7000);
       
  2. Omri Shaked 2013-03-06

    Forgot to mention, happens on iOS 6.1 with SDK 3.0.0.GA. Issue should be updated with the SDK and iOS.
  3. jithinpv 2013-05-06

    cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 iOS iPhone Simulator: iOS SDK version: 6.0
  4. jithinpv 2013-06-21

    Issue does not reproduces Tested with iOS SDK: 5.1 iOS iPhone Simulator: 5.1 Mac OS X Version 10.7.5 Titanium SDK version 3.1.1.v20130606121419 Titanium Studio, build: 3.0.1.201212181159
  5. Lee Morris 2017-03-23

    Closing ticket as "Cannot Reproduce" with reference to the above comments.

JSON Source