繁体   English   中英

如何格式化右侧相邻的两个 UIBarButtonItem?

[英]How to format two UIBarButtonItems next to each other on the right?

我正在尝试格式化两个 UIBarButtonItem,使它们在右上角彼此相邻。 我已经尝试过更改 UI 边缘插图,但它并没有真正移动图标。 当前 UI 栏的屏幕截图

lazy var profileButton = UIBarButtonItem(
    image: UIImage(named: "account"),
    style: .plain,
    target: self,
    action: #selector(displayAccountViewController(sender:))
)

lazy var followFriendsButton = UIBarButtonItem(
    image: UIImage(named: "follow"),
    style: .plain,
    target: self,
    action: #selector(displayFollowFriendsViewController(sender:))
)

override func viewDidLoad() {
    super.viewDidLoad()
    navigationItem.title = "Review Feed"

    tableView.register(ReviewFeedCell.self, forCellReuseIdentifier: cellReuseIdentifier)
    tableView.separatorStyle = .none

    navigationItem.rightBarButtonItems = [profileButton, followFriendsButton]

    NotificationCenter.default.addObserver(self, selector: #selector(loadData), name: ShowCollector.updateNotification, object: nil)
}

您应该更改图像的大小。

参考 Apple 设计指南

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM