2013-05-13 138 views

回答

1

那麼,蘋果的iOS人機界面指南指出「不要以編程方式指定導航欄的高度」。

所以你不能,這是硬編碼爲iPad上的44dip。

然而,你可能只是使自己的導航欄視圖,你自定義的梯度,只是它漂到你的窗口的頂部,這是一個開始,用50像素的背景漸變和自定義高度:

var win = Ti.UI.createWindow({ 
    navBarHidden : true 
}); 
var navBar = Ti.UI.createView({ 
    top : 0, 
    width : Ti.UI.FILL, 
    height : 50, // Your custom navbar height 
    backgroundGradient : { // Nice linear gradient, put your own custom colors here 
     type : 'linear', 
     startPoint : { 
      x : 0, 
      y : 0 
     }, 
     endPoint : { 
      x : 0, 
      y : '100%' 
     }, 
     colors : [{ 
      color : '#75060a', 
      offset : 0.0 
     }, { 
      color : '#cc0000', 
      offset : 1.0 
     }] 
    } 
}); 
// I usually add a bottom border view, just looks better IMO 
navbar.add(Ti.UI.createView({ 
    width : Ti.UI.FILL, 
    height : 1, 
    bottom : 0, 
    backgroundColor : '#000000' 
})) 
win.add(navBar); 

您可能需要爲此添加自定義按鈕和標題,以使其更具功能性,但這應該讓您開始。關於這種方法的好處是你擁有最多的控制權,並且它的完全跨平臺(在android上工作的很好)。

+0

這意味着我需要爲標題欄創建一個視圖!並給出具體的高度! – Kiran 2013-05-13 21:04:34

+0

是啊,怪蘋果,但至少你可以爲android/blackberry/mobile web和ios構建這種方法。 – 2013-05-13 22:00:24

+0

我不怪蘋果!但它沒關係,他們提供了一些替代其他第二階段的手機呢! – Kiran 2013-05-16 19:20:46