簡體   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