【问题标题】:Why button Widths are conflicts in UINavigationbar?为什么按钮宽度在 UINavigationbar 中有冲突?
【发布时间】:2023-03-27 16:29:01
【问题描述】:

我在 UINavigation 中有一个按钮 条形按钮项

这是我的期望,但真正发生的是 按钮宽度越来越低,如何克服这个恒定的宽度?任何想法的朋友。

【问题讨论】:

  • 你有在导航栏中拖放 UIButton 吗?或以编程方式设置它?检查你的 UIButton 大小。
  • 在这个地方使用右侧的 UIbarbuttonItem
  • 从情节提要@BadalShah拖放
  • 好的,然后检查你的 UIButton 框架大小。
  • @Anbu.Karthik(doodleblue) 兄弟你是对的,你为我回答了很多问题,谢谢 :)

标签: ios objective-c uinavigationcontroller uinavigationbar rightbarbuttonitem


【解决方案1】:

您是否尝试在 Size Inspector 中增加 UIButton 的宽度?

【讨论】:

  • 确保选择的是按钮本身,而不是条形按钮项
【解决方案2】:

以编程方式将您的按钮设置为 rightBarButtonItem。

UIBarButtonItem *rightbutton = [[UIBarButtonItem alloc] initWithTitle:@"Button Title here" style:UIBarButtonItemStyleDone target:self action:@selector(buttonTapped:)];
self.navigationItem.rightBarButtonItem = settingButton;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-18
    • 2015-01-19
    相关资源
    最近更新 更多