简体   繁体   English

如何在Titanium Mobile上创建类似于表格视图的选择器?

[英]How do I create a picker that acts like a table view on Titanium Mobile?

How do I create a pickerRow that acts like a tableViewRow with the hasChild property? 如何使用hasChild属性创建一个类似于tableViewRow的pickerRow? I wish to achieve the affect of the back button on the screen after. 我希望在之后实现屏幕上的后退按钮的效果。

Assuming that you have a TabGroup/TabView on the parent window, you can just add in a event listener in the pickerRow which you can call tabs.open(new_window), which will have the same effect. 假设您在父窗口上具有一个TabGroup / TabView,则只需在pickerRow中添加一个事件侦听器,即可调用tabs.open(new_window),这将具有相同的效果。

So: 所以:

var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({title: 'old win'});
var win2 = Ti.UI.createWindow({title: 'new win'});
var tab = Ti.UI.createTab({window: win1});
tabGroup.tabs = [tab];
tabGroup.setActiveTab(0);

var pickerRow = Ti.UI.createPickerRow();
pickerRow.addEventListener('click', function(e) { tab.open(win2); });

But then again, I've never seen a pickerRow act as a window opener, so I'm going to say this isn't 100% supported by the Titanium SDK itself. 但是话又说回来,我从未见过pickerRow充当开窗器,所以我要说Titanium SDK本身并不100%支持此功能。

原来,您需要在选择器本身上添加事件,然后可以打开一个新窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 你如何创建一个像jquery一样的函数的包装器对象 - how do you create a wrapper object that acts as a function like jquery 如何在iOS Titanium中创建复选框? - How do I create a checkbox in iOS Titanium? 如何创建一个像表单元素一样的Web组件? - How can I create a web component that acts like a form element? 如何创建一个像水平滚动条一样的按钮? - How can I create a button that acts like a horizontal scroll bar? 如何将js文件添加到Titan移动项目 - How do I add a js file to titanium mobile project 我如何使用javascript在类似IOS Picker视图的对象上创建轻拂的“ momemtum效果” - how can i create a flick “momemtum effect” on an object like IOS picker view using javascript 如何创建带有固定标头的HTML表,该标头可在适用于Windows Mobile的IE等手机中使用? - How can I create an HTML table with a fixed header that works in mobile phones like IE for windows mobile? 如何防止钛合金视图中的事件冒泡? - How do I prevent event bubbling in a Titanium Alloy view? 如何在 CouchDB 中创建“喜欢”过滤器视图 - How do I create a "like" filter view in CouchDB 移动应用程序表视图中的附加行必须永久保留(钛) - Appended row in table view of mobile application must retain permanently (titanium)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM