【发布时间】:2013-11-10 10:51:55
【问题描述】:
我知道如何在 Titan 中创建和设置 iOS 刷新按钮,但我不知道如何让它们真正刷新选项卡/窗口中的数据。我为我的 app.js 和其他四个选项卡创建了刷新按钮,但它不会刷新数据。
var Cloud = require('ti.cloud');
var scrollView4 = Ti.UI.createScrollView({
contentWidth: 'auto',
contentHeight: 'auto',
showVerticalScrollIndicator: true,
showHorizontalScrollIndicator: true
});
Titanium.UI.currentWindow.add(scrollView4);
var currentWin4 = Titanium.UI.currentWindow;
var refreshBtn = Titanium.UI.createButton({
Color: 'black',
systemButton : Titanium.UI.iPhone.SystemButton.REFRESH
});
currentWin4.setLeftNavButton(refreshBtn);
currentWin4.add(refreshBtn);
var l1 = Ti.UI.createLabel({
left: 10,
top: 15,
width:'auto',
height:40,
color: '#1E90FF',
text: 'About us',
font: {
fontWeight: 'bold',
fontSize: 20
}
});
scrollView4.add(l1);
var l2 = Ti.UI.createLabel({
left:10,
top: 50,
width:'auto',
height:40,
color: '#336699',
text: 'photo sharing app',
font: {
fontSize: 13
}
});
scrollView4.add(l2);
var l3 = Ti.UI.createLabel({
left: 10,
top: 90,
width:'auto',
height:40,
color: '#336699',
text: '',
font: {
fontSize: 13
}
});
scrollView4.add(l3);
var l5 = Ti.UI.createLabel({
left: 10,
top: 170,
width:'auto',
height:40,
color: '#336699',
text: 'locate us!',
font: {
fontSize: 13
}
});
scrollView4.add(l5);
var l6 = Ti.UI.createLabel({
right: 10,
top: 250,
width:'auto',
height:40,
color: '#1E90FF',
text: 'Development & API',
font: {
fontWeight: 'bold',
fontSize: 20
}
});
scrollView4.add(l6);
var b1 = Ti.UI.createButton({
right: 10,
top: 290,
width:'auto',
height:40,
color: '#336699',
title: 'Development & API',
font: {
fontSize: 13
}
});
scrollView4.add(b1);
var l9 = Ti.UI.createLabel({
center: 0,
top: 460,
width: 'auto',
height: 40,
color: '#1E90FF',
text: 'complaints?'
});
scrollView4.add(l9);
var b2 = Ti.UI.createButton({
center: 0,
top: 500,
width:'auto',
height: 40,
color: '#336699',
title: 'talk to us'
});
scrollView4.add(b2);
var emailDialog = Titanium.UI.createEmailDialog({toRecipients:['zyaine@gmail.com']});
emailDialog.Subject = ('');
emailDialog.messageBody = '';
b2.addEventListener('click',function(e)
{
emailDialog.open();
});
emailDialog.addEventListener('complete',function(e)
{
if (e.result == emailDialog.SENT)
{
alert("message sent");
}
else
{
alert("message not sent");
}
【问题讨论】:
-
有代码吗?没有它就不清楚你在问什么。
-
感谢您的回复,我已经用示例代码(选项卡)编辑了我的问题
-
好吧...我不是说代码转储,你能把它精简到你认为的问题吗?
-
您的代码中没有任何内容可用于刷新 Button 的 listner 。刷新是什么意思?你愿意点击刷新按钮清除归档数据吗?另一件事,您在左侧导航和滚动视图中添加刷新按钮。清楚你想要什么得到正确的解决方案,谢谢
-
请原谅我,我对钛的知识还不是很了解...我有刷新按钮,但我想,点击它会刷新页面中的数据。如果仍然不能很好地解释它,请给我一个我可以学习的示例代码。谢谢。
标签: button titanium refresh appcelerator simulator