2016-02-27 5 views
0

Я пытаюсь создать верхнее сообщение в своем приложении (iOS, Android). Это сообщение будет показано при поступлении push-уведомления, но я не могу его сделать. Это код, который я использую.Message top window like whatsapp

var MessageWindow = require('js/messageWindow'), 
    messageWin = new MessageWindow(); 
    messageWin.setLabel("Probando mensajes en la parte superior"); 
    messageWin.open(); 
    setTimeout(function(){ messageWin.close({opacity:0,duration:500}); },3000); 

И messageWindow является:

function MessageWindow() { 
var win = Titanium.UI.createWindow({ 
top: 0, 
    height: '30%', 
    width: '98%', 
    borderRadius:10, 
    touchEnabled:false, 
}); 
var messageView = Titanium.UI.createView({ 
    id:'messageview', 
    height:'25%', 
    width: '95%', 
    borderRadius:10, 
    backgroundColor:'#000', 
    opacity:0.7, 
    touchEnabled:false 
}); 
var messageLabel = Titanium.UI.createLabel({ 
    id:'messagelabel', 
    text:'', 
    color:'#fff', 
    width: '85%', 
    height:'auto', 
    font:{ 
     fontFamily:'Helvetica Neue', 
     fontSize:13 
    }, 
    textAlign:'center' 
}); 
messageView.add(messageLabel); 
win.add(messageView); 
this.setLabel = function(_text) { 
    messageLabel.text = _text; 
}; 
this.open = function(_args) { 
    win.open(_args); 
}; 
this.close = function(_args) { 
    win.close(_args); 
}; }module.exports = MessageWindow; 

Вот вам скриншот того, что я хочу

enter image description here

Я пытаюсь несколько конфигураций в Окно без успеха .. Заранее спасибо

ответ

3

Вы можете использовать this widgetTi.Notifications

enter image description here

+0

взлетов! для Разрешить ..... может ли это работать с классическим развитием? –