How to adjust space between two UIBarButtonItem in rightBarButtonItems

前端 未结 14 2103
悲&欢浪女
悲&欢浪女 2020-12-08 06:44

I am using the following codes to add two button to self.navigationItem.rightBarButtonItems, and I think in iOS7, the space between two buttons are too wide, is there a way

14条回答
  •  难免孤独
    2020-12-08 07:17

    Swift 5

    In your AppDelegate add this code:

    let stackViewAppearance = UIStackView.appearance(whenContainedInInstancesOf: [UINavigationBar.self])
    stackViewAppearance.spacing = -10
    

提交回复
热议问题