[TIMOB-15281] iOS: TableView search bar reduces to 50% width when rotation is performed
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-09-20T21:53:42.000+0000 |
Affected Version/s | Release 3.1.1, Release 3.1.2, Release 3.1.3 |
Fix Version/s | 2013 Sprint 19, 2013 Sprint 19 API, Release 3.1.4, Release 3.2.0 |
Components | iOS |
Labels | Titanium, ios7, mobilesdk, module_tableview, qe-testadded |
Reporter | Ashish Nigam |
Assignee | Vishal Duggal |
Created | 2013-09-19T14:00:03.000+0000 |
Updated | 2014-03-25T21:00:21.000+0000 |
Description
When we rotate the device to landscape mode and then take it back to portrait mode. Table view search bar reduces to 50% width without performing that action.
*Steps to reproduce*
1: Use the below sample code and use it new sample project.
2: run the sample on iOS simulator.
3: rotate the simulator to landscape mode.
4: now rotate the simulator to portrait mode.
result: Search bar gets half of width automatically.
*Sample code*
var rootWin = Ti.UI.createWindow({
title : L('rootWinTitle'),
backgroundColor : 'yellow',
orientationModes : [Titanium.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Titanium.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_RIGHT]
});
var filterBox = Ti.UI.createSearchBar({
visible : true, /*backgroundImage: "/Images/search_box_background.png", */
hintText : "Filter this list",
width : Ti.UI.FILL
});
var props = {
filterCaseInsensitive : true,
top : 0,
search : filterBox,
width : "100%",
rowHeight : 42,
backgroundColor : "#FFF",
separatorColor : "#b0b0b0",
allowsSelection : true,
scrollable : true,
searchHidden : false,
hideSearchOnSelection : true,
anchorPoint : {
x : 0.5,
y : 0.0
}
};
// Rotates about its X axis, half way along.
props.style = Ti.UI.iPhone.TableViewStyle.PLAIN;
/* GROUPED or PLAIN */
var tableView = Ti.UI.createTableView(props);
var i = 0;
var rows = [];
var indexes = [];
for ( i = 0; i < 20; i++) {
var tablerow = Ti.UI.createTableViewRow({
height : 70,
className : 'itemRow',
hasChild : true
});
var imageview = Ti.UI.createImageView({
image : "imageUrl.jpg",
height : 36,
width : 36,
left : 5,
top : 17
});
var titleview = Ti.UI.createLabel({
text : "Item: " + i,
color : '#000',
height : 65,
font : {
fontSize : 15
},
left : imageview.width + 10
});
tablerow.add(imageview);
tablerow.add(titleview);
rows.push(tablerow);
}
tableView.setData(rows);
var indexes = [{
title : '1',
index : 0
}, {
title : '2',
index : 1
}, {
title : '3',
index : 2
}, {
title : '4',
index : 3
}, {
title : '5',
index : 4
}, {
title : '6',
index : 5
}, {
title : '7',
index : 6
}, {
title : '8',
index : 7
}, {
title : '9',
index : 8
}, {
title : '10',
index : 9
}, {
title : '11',
index : 10
}, {
title : '12',
index : 11
}, {
title : '13',
index : 12
}, {
title : '14',
index : 13
}, {
title : '15',
index : 14
}, {
title : '16',
index : 15
}, {
title : '17',
index : 16
}, {
title : '18',
index : 17
}, {
title : '19',
index : 18
}, {
title : '20',
index : 19
}];
tableView.index = indexes;
//mainWindow.add(tableView);
rootWin.add(tableView);
rootWin.open();
Pull pending https://github.com/appcelerator/titanium_mobile/pull/4717
Backport to 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4722
Tested with : OSX: 10.8.5 Xcode:5.0 Appcelerator Studio: 3.2.0.201310112258 SDK:3.2.0.v20131014204636 acs:1.0.7 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processo:1.0.3 Device: iPod touch2 (viOS7)