2012-07-08 40 views
1

有没有人有关于如何在iOS中创建多行导航/顶栏的线索?我想要的东西类似于WhatsApp中的状态行(显示上次显示的状态行或当前状态信息)。 任何意见,将不胜感激。如何创建一个类似于iOS中的WhatsApp中的多行导航栏?

我要实现类似的图像(弗朗西斯·惠特曼/最后于[...]):

enter image description here

+1

很容易让人们为您解答......张贴的截图而不是期望人们下载一些随机应用程序。 – coneybeare 2012-07-08 17:32:34

+1

@coneybeare有时候我不知道这样的问题是否仅仅是为了获取应用程序下载而进行的简单尝试。 – 2012-07-08 17:58:20

回答

3

默认情况下,UINavigationController将使用当前显示的title财产在其导航栏中显示标题的视图控制器。你可以把它显示任意的观点,但是,通过设置视图控制器的navigationItem属性的titleView财产,像这样:

// In your view controller’s implementation (.m) file: 
- (id)initWithNibName:(NSString *)nibName 
       bundle:(NSStirng *)nibBundle 
{ 
    self = [super initWithNibName:nibName bundle:nibBundle]; 

    if (self) { 
     UIView *myTitleView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 
                     0.0f, 
                     250.0f, 
                     44.0f)]; 
     [myView setBackgroundColor:[UIColor greenColor]]; 

     [[self navigationItem] setTitleView:myTitleView]; 
    } 

    return self; 
} 
+0

这是一个开始,非常感谢! – Maciek 2012-07-08 18:21:11

0
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width/2, 200)]; 
[label setBackgroundColor:[UIColor clearColor]]; 
[label setTextColor:[UIColor whiteColor]]; 
[label setTextAlignment:NSTextAlignmentCenter]; 
[label setNumberOfLines:0]; 
[label setText:_certificate.name]; 
self.navigationItem.titleView = label; 
相关问题