Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 标签一直从我的导航菜单中消失_Ios_Objective C_Uibarbuttonitem - Fatal编程技术网

Ios 标签一直从我的导航菜单中消失

Ios 标签一直从我的导航菜单中消失,ios,objective-c,uibarbuttonitem,Ios,Objective C,Uibarbuttonitem,由于某些原因,我的导航栏中的标签一直消失,只显示我的地图图标和主页按钮。是因为我把它作为巴布托教徒加入的吗?有办法解决这个问题吗 UIView *view1=[[UIView alloc]initWithFrame:CGRectMake(160, 5, 250, 70)]; UILabel *l1=[[UILabel alloc]initWithFrame:CGRectMake(0,5, 310, 70)]; l1.text=@"FIND THINGS TO DO"; l

由于某些原因,我的导航栏中的标签一直消失,只显示我的地图图标和主页按钮。是因为我把它作为巴布托教徒加入的吗?有办法解决这个问题吗

UIView *view1=[[UIView alloc]initWithFrame:CGRectMake(160, 5, 250, 70)];
    UILabel *l1=[[UILabel alloc]initWithFrame:CGRectMake(0,5, 310, 70)];
    l1.text=@"FIND THINGS TO DO";
    l1.font=[UIFont fontWithName:@"Helvetica Neue LT Std" size:25.0];
    l1.backgroundColor=[UIColor clearColor];
    l1.textColor=[UIColor whiteColor];
    l1.textAlignment=UITextAlignmentCenter;
    [view1 addSubview:l1];
    UIBarButtonItem *left2=[[UIBarButtonItem alloc]initWithCustomView:view1];
    self.navigationItem.rightBarButtonItem=left2;
    [self.navigationItem setHidesBackButton:YES]; 

    self.navigationItem.hidesBackButton=YES;
    self.navigationController.navigationBarHidden = NO;

    UIImage* image3 = [UIImage imageNamed:@"home_btn.png"];
    homeBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 18, 38, 38)];
    [homeBtn setBackgroundImage:image3 forState:UIControlStateNormal];
    [homeBtn addTarget:self action:@selector(Home)
      forControlEvents:UIControlEventTouchUpInside];
    [homeBtn setShowsTouchWhenHighlighted:YES];

    UIBarButtonItem *home = [[UIBarButtonItem alloc] initWithCustomView:homeBtn];
    NSArray *arr=[[NSArray alloc]initWithObjects:home, nil];
    self.navigationItem.rightBarButtonItems = arr;

    UIImage* mapButton1 = [UIImage imageNamed:@"Top-Map-Icon.png"];
    mapButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 18, 26, 30)];
    [mapButton setBackgroundImage:mapButton1 forState:UIControlStateNormal];
    [mapButton addTarget:self action:@selector(Map)
        forControlEvents:UIControlEventTouchUpInside];
    [mapButton setShowsTouchWhenHighlighted:YES];

    UIBarButtonItem *map = [[UIBarButtonItem alloc] initWithCustomView:mapButton];
    NSArray *arr2 = [[NSArray alloc] initWithObjects:map, nil];
    self.navigationItem.leftBarButtonItems = arr2;

也许你的文字太长了,当你添加工具栏按钮时,你的文字没有足够的地方显示?是的,我试着改变UIView的大小以及标签的大小,但没有效果。