Latest 0.1.0
Homepage https://github.com/funzin/StackBarButtonItem
License MIT
Platforms ios 9.0
Dependencies RxSwift, RxCocoa
Authors

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

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

position Default StackBarButtonItem
right navigationItem.setRightBarButtonItems navigationItem.right.setStackBarButtonItems
left navigationItem.setLeftBarButtonItems navigationItem.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

Margin ScreenShot
margin == 0 StackBarButtonItem
margin == 10 StackBarButtonItem

Spacing

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

Example

Spacing ScreenShot
spacing == 0 StackBarButtonItem
spacing == 10 StackBarButtonItem

Reverse

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

Example

Reverse ScreenShot
reversed == false StackBarButtonItem
reversed == true StackBarButtonItem

Demo

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

Author

funzin, [email protected]

License

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

Latest podspec

{
    "name": "StackBarButtonItem",
    "version": "0.1.0",
    "summary": "StackBarButtonItem can use BarButtonItem like stackView.",
    "homepage": "https://github.com/funzin/StackBarButtonItem",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "funzin": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/funzin/StackBarButtonItem.git",
        "tag": "0.1.0"
    },
    "source_files": "StackBarButtonItem/**/*.{swift}",
    "dependencies": {
        "RxSwift": [
            "~> 4.3.1"
        ],
        "RxCocoa": [
            "~> 4.3.1"
        ]
    },
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This