Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robertherdzik/RHSideButtons
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. πΆ
https://github.com/robertherdzik/RHSideButtons
action-buttons android buttons demo floating material menu rhsidebuttons-library sidemenu
Last synced: about 1 month ago
JSON representation
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. πΆ
- Host: GitHub
- URL: https://github.com/robertherdzik/RHSideButtons
- Owner: robertherdzik
- License: mit
- Created: 2016-05-29T16:13:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-05T17:05:09.000Z (over 5 years ago)
- Last Synced: 2024-04-24T14:50:38.943Z (9 months ago)
- Topics: action-buttons, android, buttons, demo, floating, material, menu, rhsidebuttons-library, sidemenu
- Language: Swift
- Homepage:
- Size: 4.53 MB
- Stars: 165
- Watchers: 12
- Forks: 22
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - RHSideButtons - Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. (UI / Menu)
- awesome-ios-star - RHSideButtons - Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. (UI / Menu)
README
![](./ReadmeAssets/RHSideButtonsHeadLogo.gif)
[![Version](https://img.shields.io/cocoapods/v/RHSideButtons.svg?style=flat)](http://cocoadocs.org/docsets/RHSideButtons)
[![License](https://img.shields.io/cocoapods/l/BadgeSwift.svg?style=flat)](/LICENSE)
[![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat)](https://developer.apple.com/iphone/index.action)
[![Language](http://img.shields.io/badge/language-swift-brightgreen.svg?style=flat)](https://developer.apple.com/swift)
[![Twitter](https://img.shields.io/twitter/follow/Roherdzik.svg?style=social&label=Follow)](https://twitter.com/Roherdzik)# RHSideButtons πΆ
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. πΆ## Play with it π
## Installation
You can install RHSideButtons library using CocoaPods:
```
pod 'RHSideButtons'
```
or you can simply copy ```RHSideButtons``` folder to your project.## Usage
You just need implement `RHSideButtonsDataSource` and `RHSideButtonsDelegate` similar to well-known UIKit design.```swift
// You need to firstly create trigger button. You can do this using block or your builder object which should conform to 'RHButtonViewConfigProtocol'
// RHTriggerButtonView allows you to change image for pressed state! ππ»
let triggerButton = RHTriggerButtonView(pressedImage: UIImage(named: "exit_icon")!) {
$0.image = UIImage(named: "trigger_img")
$0.hasShadow = true
}// Then you need to create instance of SideButtons coordinator class with your View Controller view (it can be even TableView)
sideButtonsView = RHSideButtons(parentView: view, triggerButton: triggerButton)
sideButtonsView.delegate = self
sideButtonsView.dataSource = self// When SideButtons controller is initialized properly you should set thier position in view in e.g. viewWillAppear method:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)sideBttns?.setTriggerButtonPosition(CGPoint(x: bounds.width - 85, y: bounds.height - 85))
}
```... let us prepare our data models for buttons π₯ below you can see one of many ways to do this:
```swift
//Finally you should create array of buttons which will feed our dataSource and Delegate methods :) e.g.:
let button_1 = RHButtonView {
$0.image = UIImage(named: "icon_1")
$0.hasShadow = true
}let button_2 = RHButtonView {
$0.image = UIImage(named: "icon_2")
$0.hasShadow = true
}let button_3 = RHButtonView {
$0.image = UIImage(named: "icon_3")
$0.hasShadow = true
}buttonsArr.appendContentsOf([button_1, button_2, button_3])
//Similar as it is in TableView, now you should reload buttons with new values
sideButtonsView.reloadButtons()
```
π‘ important thing is that you need to reload buttons when your datasource has changed using ```reloadButtons()``` method (π± simple rightβ)### RHSideButtonsDataSource
```swift
func sideButtonsNumberOfButtons(sideButtons: RHSideButtons) -> Int
func sideButtons(sideButtons: RHSideButtons, buttonAtIndex index: Int) -> RHButtonView
```### RHSideButtonsDelegate
```swift
func sideButtons(sideButtons: RHSideButtons, didSelectButtonAtIndex index: Int)
func sideButtons(sideButtons: RHSideButtons, didTriggerButtonChangeStateTo state: RHButtonState)
```
## Support for left-handers :)
If you decide to position RHSideButtons on the left site of view, buttons will dissapears to the left side of screen automatically.e.g.:
```swift
sideBttns?.setTriggerButtonPosition(CGPoint(x:25, y: frame.size.height - 85))
```
## Swift support
| Library ver| Swift ver|
| ------------- |:-------------:|
| 1.0 | 2.2 |
| 1.0.1 | 3.0 |
| 1.1.0 | 4.0 |## Check the Demo project
Please check out the demo project, you can see there what is the best (in my opinion π€) way to implement my buttons. Please keep in mind that Readme contains the simplest way to implement this control.