如何在uinavigationbar中添加特定位置的项目?

Use*_*343 2 iphone uinavigationbar uinavigationitem navigationbar ios

我正在为iphone开发一个应用程序,因为我UILabel在某个特定位置的导航栏中添加了一个以上的问题.

我想要的是以下图像

在此输入图像描述

在上面的图像中有一个后退按钮和一个imageview带箭头标记的按钮.除此之外,所有白色框都是为了UILabels在导航栏中显示不同.UIImageView导航栏中只有一个,左侧有一个按钮.现在问题是我不知道如何添加多个UILabel在特定位置的导航栏中.

到目前为止,我所做的只是添加按钮和UIImageView右边的条形按钮阵列或左边的按钮阵列,但只能添加项目.

所以任何人都可以指导我如何在特定位置添加UILabel或任何其他项目.

Nit*_*hel 7

你可以添加多个UIlabel或图像看起来像贝娄图像: -

在此输入图像描述

这可以使用波纹管代码,您可以更改标签和imageView框架,并根据您的要求

- (void)viewDidLoad
{

    UIView *btn = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];

    UILabel *label;
    label = [[UILabel alloc] initWithFrame:CGRectMake(5, 25, 200, 16)];
    label.tag = 1;
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont boldSystemFontOfSize:16];
    label.adjustsFontSizeToFitWidth = NO;
    label.textAlignment = UITextAlignmentLeft;
    label.textColor = [UIColor whiteColor];
    label.text = @"My first lable";
    label.highlightedTextColor = [UIColor whiteColor];
    [btn addSubview:label];
    [label release];

    label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 200, 16)];
    label.tag = 2;
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont boldSystemFontOfSize:16];
    label.adjustsFontSizeToFitWidth = NO;
    label.textAlignment = UITextAlignmentRight;
    label.textColor = [UIColor whiteColor];
    label.text = @"second line";
    label.highlightedTextColor = [UIColor whiteColor];
    [btn addSubview:label];
    [label release];


    UIImageView *imgviw=[[UIImageView alloc]initWithFrame:CGRectMake(170, 10, 20, 20)];
     imgviw.backgroundColor = [UIColor blackColor];
    imgviw.image=[UIImage imageNamed:@"a59117c2eb511d911cbf62cf97a34d56.png"];
     [btn addSubview:imgviw];

    self.navigationItem.titleView = btn;

}
Run Code Online (Sandbox Code Playgroud)