导航栏项目未显示完整

时间:2016-06-06 16:45:09

标签: ios swift

我可以看到这一点(文字应该是“项目”,它显示“我... m”)

enter image description here

当我尝试使用故事板添加导航栏项目时。谁知道为什么? 这就是我添加该按钮的方式:

<option value="<?php echo $id;?>"><?php echo $stringversion;?></option>

1 个答案:

答案 0 :(得分:1)

将UIButton作为UIBarButton的customView来设置UIBarButton的自定义宽度。

// create the nav bar back button
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 24)];
[backButton setTitle:@"Item" forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem = buttonItem;