我知道如何在钛中创建和设置 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");
}