Quantcast
Viewing all articles
Browse latest Browse all 8068

Keyboard vanishes when orientation changed

I have a textfield added to a scrollable view. If the text field is in focus with the keyboard open and I change orientation of the simulator, the keyboard vanishes when the orientation is changed. I have provided code below,

var win = Ti.UI.createWindow();
 
var view1 = Ti.UI.createView({ backgroundColor:'#123' });
var view2 = Ti.UI.createView({ backgroundColor:'#246' });
var view3 = Ti.UI.createView({ backgroundColor:'#48b' });
var searchBox = Ti.UI.createTextField({
        height: 38,
        width: 100,
        backgroundColor: '#f1f1f1',
        paddingLeft: 12,
        borderColor: '#ededed',
        borderWidth: 1,
        top:10,
});
 searchBox.addEventListener('focus', function() {
        Ti.API.info('search box is in focus');
    });
 
    searchBox.addEventListener('blur', function() {
        Ti.API.info('searchbox is blur');
    });
view1.add(searchBox);
var scrollableView = Ti.UI.createScrollableView({
  views:[view1,view2,view3],
  showPagingControl:true
});
 
win.add(scrollableView);
win.open();
How can I keep the keyboard open, when the orientation is changed. Please help. Thanks in advance.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>