2013-05-13 99 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