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

iOS: TableView search bar reduces to 50% width when rotation is performed

    Details

      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();
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vduggal Vishal Duggal (Inactive)
                Reporter:
                anigam Ashish Nigam
                Reviewer:
                Sabil Rahim
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code