這似乎是一個奇怪的問題,但在Appcelerator Titanium中爲多個平臺開發時,方便地知道元素在哪裏結束,因爲這些設備具有不同的尺寸。檢查Titanium中對象(即GROUPED tableView)的尺寸(頂部,底部,左側,右側位置)
那麼,有沒有可能知道對象的開始和結束?例如,我有一個分組表格視圖,在它下面我有一張地圖,我想要使用分組tableView下剩餘的所有可用空間。我該怎麼做呢?
我試過如下:
var winDetailView = Titanium.UI.currentWindow;
var tableDetailRowData = getDetailData();
var tableDetailView = Ti.UI.createTableView({
headerTitle:'Object',
style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
backgroundColor:'transparent',
data:tableDetailRowData,
height : Ti.UI.SIZE,
});
winDetailView.add(tableDetailView);
var mapView = Ti.Map.createView({
top : 200, // this is approximately where my table ends (is there a way to know the exact place?)
left : "10%",
height : "90%", // this doesn't work, since it uses 90% of the device height pixels, not 90% of the remaining pixels below the top property
width : "90%",
mapType : Ti.Map.STANDARD_TYPE,
})
但這並不做的伎倆。有任何想法嗎?
更新: getSize()
屬性似乎與某些對象一起使用。不幸的是,使用Grouped tableView時,返回的大小几乎是所有的屏幕,所以它沒有提供必要的尺寸。
嗨,謝謝。這**幾乎**就像我打算的那樣工作。但是通過這段代碼,分組表中的最後一行大部分都沒有了。有任何想法嗎? – jbssm 2013-04-22 15:30:05
當您滾動表格時是否出現? – 2013-04-22 15:33:11
我現在檢查,是的,它確實。 – jbssm 2013-04-22 15:33:50