sta

StackBarButtonItem

🔲 StackBarButtonItem can use BarButtonItem like StackView

Showing:

Popularity

Downloads/wk

0

GitHub Stars

52

Maintenance

Last Commit

2yrs ago

Contributors

0

Package

Dependencies

2

License

MIT

Categories

Readme

StackBarButtonItem

StackBarButtonItem

Platform Language Carthage Version License

StackBarButtonItem can use BarButtonItem like stackView.

Features

  • NavigationBar margin
  • Spacing between view
  • Reverse view

Support

  • Device: iPad | iPhone
  • Orientation: Portrait | Landscape
  • Multitasking

Requirements

  • Xcode10 or greater
  • iOS9 or greater
  • Swift4.2 or greater

Dependencies

Installation

Carthage

If you’re using Carthage, simply add StackBarButtonItem to your Cartfile:

github "funzin/StackBarButtonItem"

CocoaPods

StackBarButtonItem is available through CocoaPods. To instal it, simply add the following line to your Podfile:

pod 'StackBarButtonItem'

Usage

Correspondence Table

positionDefaultStackBarButtonItem
rightnavigationItem.setRightBarButtonItemsnavigationItem.right.setStackBarButtonItems
leftnavigationItem.setLeftBarButtonItemsnavigationItem.left.setStackBarButtonItems

Introduction

iOS11 or later

If iOS version is iOS11 or later, you must use autolayout.

import StackBarButtonItem
・
・
・

// use autolayout
let rightButton = UIButton(frame: CGRect(x: 0, y: 0, width: 44, height: 44))
NSLayoutConstraint.activate([
    rightButton.widthAnchor.constraint(equalToConstant: 44),
    rightButton.heightAnchor.constraint(equalToConstant: 44)
])
self.navigationItem.right.setStackBarButtonItems(views: [rightButton])

iOS9 or iOS10

If iOS version is iOS9 or iOS10, you must configure frame.

import StackBarButtonItem
・
・
・

// configure frame
let rightButton = UIButton(frame: CGRect(x: 0, y: 0, width: 44, height: 44))
self.navigationItem.right.setStackBarButtonItems(views: [rightButton])

Margin

// e.g. set margin to 10
self.navigationItem.right.setStackBarButtonItems(views: [rightButton], margin: 10)

Example

MarginScreenShot
margin == 0
margin == 10

Spacing

// e.g. set spacing to 10
self.navigationItem.right.setStackBarButtonItems(views: [rightButton1, rightButton2], spacing: 10)

Example

SpacingScreenShot
spacing == 0
spacing == 10

Reverse

// e.g. set reversed to true
self.navigationItem.right.setStackBarButtonItems(views: [rightButton1, rightButton2], reversed: true)

Example

ReverseScreenShot
reversed == false
reversed == true

Demo

If you are interested in StackBarButtonItem, please check demo after carthage update

Author

funzin, nakazawa.fumito@gmail.com

License

StackBarButtonItem is available under the MIT license. See the LICENSE file for more info.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100