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

iOS: Search bar disappears in some cases

    Details

      Description

      Certain actions make the searchbar disappear. The easiest to reproduce is changing the device orientation when the searchbar is off screen (so when you have scrolled down a bit).
      Another way, for which I cannot easily create a piece of reproducing code, is if you update the data of a listview by simply assigning the sections again.

      The attached video shows the searchbar disappearing after rotating the device.

      // this sets the background color of the master UIView (when there are no windows/tab groups on it)
      Titanium.UI.setBackgroundColor('#000');
       
      // create tab group
      var tabGroup = Titanium.UI.createTabGroup();
       
       
      //
      // create base UI tab and root window
      //
      var win1 = Titanium.UI.createWindow({  
          title:'Tab 1',
          backgroundColor:'#fff'
      });
      var tab1 = Titanium.UI.createTab({  
          icon:'KS_nav_views.png',
          title:'Tab 1',
          window:win1
      });
       
      	var search = Ti.UI.createSearchBar({
      		barColor: '#FFFFFF',
      		borderColor: 'white'
      	});
      	search.addEventListener('cancel', function() {
      		search.blur();
      	});
       
      	var listView = Ti.UI.createListView({
      		searchView: search,
      		top: 10
      	});
       
      	var sections = [];
      	
      	var fruitSection = Ti.UI.createListSection({ headerTitle: 'Group 1'});
      	var fruitDataSet = [
      	    {properties: { title: 'Item 1'}},
      	    {properties: { title: 'Item 2'}},
      	    {properties: { title: 'Item 3'}},
      	    {properties: { title: 'Item 4'}},
      	    {properties: { title: 'Item 5'}},
      	    {properties: { title: 'Item 6'}},
      	    {properties: { title: 'Item 7'}},
      	    {properties: { title: 'Item 8'}},
      	];
      	fruitSection.setItems(fruitDataSet);
      	sections.push(fruitSection);
      	
      	var vegSection = Ti.UI.createListSection({ headerTitle: 'Group 2'});
      	var vegDataSet = [
      	    {properties: { title: 'Test 1'}},
      	    {properties: { title: 'Test 2'}},
      	    {properties: { title: 'Test 3'}},
      	    {properties: { title: 'Test 4'}},
      	    {properties: { title: 'Test 5'}},
      	    {properties: { title: 'Test 6'}},
      	    {properties: { title: 'Test 7'}},
      	    {properties: { title: 'Test 8'}},
      	];
      	vegSection.setItems(vegDataSet);
      	sections.push(vegSection);
      	
      	listView.sections = sections;
       
      	win1.add(listView);
       
      //
      // create controls tab and root window
      //
      var win2 = Titanium.UI.createWindow({  
          title:'Tab 2',
          backgroundColor:'#fff'
      });
      var tab2 = Titanium.UI.createTab({  
          icon:'KS_nav_ui.png',
          title:'Tab 2',
          window:win2
      });
       
      var label2 = Titanium.UI.createLabel({
      	color:'#999',
      	text:'I am Window 2',
      	font:{fontSize:20,fontFamily:'Helvetica Neue'},
      	textAlign:'center',
      	width:'auto'
      });
       
      win2.add(label2);
       
       
       
      //
      //  add tabs
      //
      tabGroup.addTab(tab1);  
      tabGroup.addTab(tab2);  
       
       
      // open tab group
      tabGroup.open();
      

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              martijnkooij Martijn Kooij
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration