Mobile 钛爆米花不起作用
我正在尝试使用钛合金中的“Popover”功能 我检查了厨房水槽,在我的应用程序中构建了一个代码,但有些是如何构建的 我得到了这个错误:Mobile 钛爆米花不起作用,mobile,titanium,appcelerator,appcelerator-mobile,popover,Mobile,Titanium,Appcelerator,Appcelerator Mobile,Popover,我正在尝试使用钛合金中的“Popover”功能 我检查了厨房水槽,在我的应用程序中构建了一个代码,但有些是如何构建的 我得到了这个错误: Result of expression 'Ti.UI.iPad' [undefined] is not an object. 我不知道我做错了什么 这是我的密码: var RLWindow=Ti.UI.createWindow({backgroundColor:'#700'}); var LBBar=Titanium.UI.createView({hei
Result of expression 'Ti.UI.iPad' [undefined] is not an object.
我不知道我做错了什么
这是我的密码:
var RLWindow=Ti.UI.createWindow({backgroundColor:'#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
});
});
请帮我解决这个问题
谢谢这只适用于iPad,不适用于iPhone。我猜你在用这个?对于iPhone,您应该使用常规窗口 话虽如此,按钮是什么?说出名字,我想这是你的问题,因为你需要一个视图。如果我这样做(如下),它似乎对我非常有效:
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
});
清除build/iphone文件夹。我注意到,有时当您添加一个新的平台UI对象时,编译器在xcode项目中没有包含所需的Ti库。var ShowNotes=Ti.UI.createButton({color:'blue',font:{fontSize:20,fontwweight:'bold},right:10,title:'Today Notes',height:40,width:120});确切地它需要一个视图,而不是一个按钮。在视图中,可以再次创建按钮。请看我上面的帖子,这个很好用。你能再把这个问题看一遍吗。我已经在那里更新了我的完整代码,谢谢。按钮仍然没有创建。show的view:属性应该是一个视图。你试过我的答案了吗?试着在清理旧的之后再做一个新的。并使用
popover.show({view:ShowNotes,animated:true})代码>