Air*_*lla 0 iphone macos xcode uinavigationcontroller uinavigationitem
是否可以将导航控制器标题设为按钮?但没有按钮看它.我希望它只是文本,如果你点击它,从底部弹出一个视图/动作表如果是这样,你能以编程方式告诉我如何使它成为一个按钮吗?谢谢
您可以设置TitleView的navigationItem设置按钮标题.
这是我尝试并使其工作:
UIButton*button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame=CGRectMake(0, 0, 30, 20);
[button setTitle:@"Testing" forState:UIControlStateNormal];
[button addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
[[self navigationItem] setTitleView:button];
Run Code Online (Sandbox Code Playgroud)
但是,如果你不希望它看起来像一个按钮,你已经设置了buttonWithType以custom并设置其backGroundImage属性.
在btnAction你的代码中显示弹出窗口.
| 归档时间: |
|
| 查看次数: |
267 次 |
| 最近记录: |