开发者

Titanium popover not working

i'm trying to use the "Popover " functionality in the titanium.

i went throught the kitchensink and built a code in my application but some how

i'm getting this error:

Result of expression 'Ti.UI.iPad' [undefined] is not an object.

i dont know what i'm doing wrong.

here is my code:

var RLWindow=Ti.UI.createWindow({backg开发者_StackOverflow中文版roundColor:'#700'});

var LBBar=Titanium.UI.createView({height:60,left:0,right:0,top:105,backgroundImage:'Images/toolbar.jpeg'});

var ShowNotes=Ti.UI.createButton({color:'blue',font:{fontSize:20,fontWeight:"bold"},‌​right:10,title:'Today Notes',height:40,width:120});

LBBar.add(ShowNotes);

RLWindow.add(LBBar);
ShowNotes.addEventListener('click',function(e){

    var popover = Ti.UI.iPad.createPopover({ 
        width:300, 
        height:250,
        title:'Test Popover',
        arrowDirection:Ti.UI.iPad.POPOVER_ARROW_DIRECTION_UP
    }); 

    popover.show({
        view:button,
        animated:true
    });

     });

please help me with this situation..

Thank you


Clear out your build/iphone folder. I notice sometimes when you add a new platform UI object the compiler doesn't include the required Ti library in the xcode project.


This only works on the iPad, not on the iPhone. I am assuming you are using that? For iPhone you should use a regular window.

That being said, what is button? Stating the name, I guess that is your problem, because you need a view in that. If I do this (below) it seems to be working perfectly for me:

var popover = Ti.UI.iPad.createPopover({ 
    width:300, 
    height:250,
    title:'Test Popover',
    arrowDirection:Ti.UI.iPad.POPOVER_ARROW_DIRECTION_UP
}); 

var win = Ti.UI.createWindow({backgroundColor: '#FFF'});
win.open();

var v = Ti.UI.createView();
win.add(v);

popover.show({
    view: v,
    animated:true
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜