Created
November 12, 2018 14:22
-
-
Save exclusiveTanim/f7bd1ca874527fead9a64d141ee7c90f to your computer and use it in GitHub Desktop.
2 different workaround for 01014599
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1. Use Ti.UI.iOS.NavigationWindow instead of Ti.UI.Window for property "contentView" of popover. | |
var win = Ti.UI.createWindow({backgroundColor: 'white'}); | |
var button = Ti.UI.createButton({title: 'Open Popover!', top : 100}); | |
button.addEventListener('click', function(e){ | |
popover.show({ view: button }); | |
}) | |
win.add(button); | |
var contentWindow = Ti.UI.createWindow({ | |
width : Ti.UI.SIZE, | |
height : Ti.UI.SIZE, | |
borderColor : '#CCC' | |
}); | |
var rows = []; | |
for (var i = 0; i < 4; i++) { | |
var title = 'Row '+ i; | |
rows.push({ properties: { title:title , backgroundColor: 'red', searchableText:title}}); | |
} | |
var sb = Ti.UI.createSearchBar(); | |
var ls = Ti.UI.createListSection({ | |
items: rows | |
}); | |
var lv = Ti.UI.createListView({ | |
sections: [ls], | |
searchView: sb, | |
}); | |
lv.addEventListener('itemclick', function(e) { | |
Ti.API.info('click at index: ' + e.itemIndex); | |
popover.hide(); | |
}); | |
contentWindow.add(lv); | |
var navWindow = Ti.UI.iOS.createNavigationWindow({window: contentWindow}) | |
var popover = Ti.UI.iPad.createPopover({ | |
width: 400, | |
height: 220, | |
backgroundColor: 'green', | |
contentView: navWindow | |
}); | |
win.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//2. Use Ti.UI.SearchBar as subview of window rather property of Ti.UI.ListView | |
var win = Ti.UI.createWindow({backgroundColor: 'white'}); | |
var button = Ti.UI.createButton({title: 'Open Popover!', top : 100}); | |
button.addEventListener('click', function(e){ | |
popover.show({ view: button }); | |
}) | |
win.add(button); | |
var contentWindow = Ti.UI.createWindow({ | |
width : Ti.UI.SIZE, | |
height : Ti.UI.SIZE, | |
borderColor : '#CCC' | |
}); | |
var rows = []; | |
for (var i = 0; i < 4; i++) { | |
var title = 'Row '+ i; | |
rows.push({ properties: { title:title , backgroundColor: 'red', searchableText:title}}); | |
} | |
var sb = Ti.UI.createSearchBar({ | |
top:0, | |
height:44, | |
barColor:'green', | |
showCancel: true, | |
}); | |
var ls = Ti.UI.createListSection({ | |
items: rows | |
}); | |
var lv = Ti.UI.createListView({ | |
top: 45, | |
sections: [ls] | |
}); | |
sb.addEventListener('change', function(e){ | |
lv.searchText = e.value; | |
}); | |
lv.addEventListener('itemclick', function(e) { | |
Ti.API.info('click at index: ' + e.itemIndex); | |
popover.hide(); | |
}); | |
contentWindow.add(sb); | |
contentWindow.add(lv); | |
var popover = Ti.UI.iPad.createPopover({ | |
width: 400, | |
height: 220, | |
backgroundColor: 'green', | |
contentView: contentWindow | |
}); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment