Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GitHawkApp/ContextMenu
An iOS context menu UI inspired by Things 3.
https://github.com/GitHawkApp/ContextMenu
githawk ios menu swift things uikit
Last synced: about 1 month ago
JSON representation
An iOS context menu UI inspired by Things 3.
- Host: GitHub
- URL: https://github.com/GitHawkApp/ContextMenu
- Owner: GitHawkApp
- License: mit
- Created: 2018-03-10T17:59:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-11-22T15:58:47.000Z (about 3 years ago)
- Last Synced: 2024-04-24T14:50:42.685Z (9 months ago)
- Topics: githawk, ios, menu, swift, things, uikit
- Language: Swift
- Homepage: http://githawk.com/
- Size: 233 KB
- Stars: 974
- Watchers: 22
- Forks: 51
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - ContextMenu - An iOS context menu UI inspired by Things 3. (UI / Menu)
- awesome-ios-star - ContextMenu - An iOS context menu UI inspired by Things 3. (UI / Menu)
- awesome-ios - ContextMenu - An iOS context menu UI inspired by Things 3. [•](https://raw.githubusercontent.com/GitHawkApp/ContextMenu/master/images/animation.gif) (Content / Menu)
- awesome - ContextMenu - An iOS context menu UI inspired by Things 3. (uikit)
- awesome - ContextMenu - An iOS context menu UI inspired by Things 3. (uikit)
README
- Contextual menus with delightful animations and styles
- Total control over menu contents using your own `UIViewController`s
- Tons of feature and interaction customizations## Installation
Just add `ContextMenu` to your Podfile and `pod install`. Done!
```ruby
pod 'ContextMenu'
```
For Carthage, just add `GitHawkApp/ContextMenu` to your Cartfile and `carthage bootstrap`.
```ogdl
github "GitHawkApp/ContextMenu"
```## Usage
Show the menu from one of your `UIViewController`s:
```swift
ContextMenu.shared.show(
sourceViewController: self,
viewController: MyContentViewController()
)
```You must provide a custom `UIViewController` to display in the menu. The only requirement is that you must set `preferredContentSize` to size your content.
```swift
class MyContentViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
title = "Demo"
preferredContentSize = CGSize(width: 200, height: 200)
}
}
```## Customizations
### Display from a Source View
Animate the menu out from a button or view. `ContextMenu` will take care of layout so that your menu doesn't clip the screen.
```swift
@IBAction func onButton(_ sender: UIButton) {
ContextMenu.shared.show(
sourceViewController: self,
viewController: MyContentViewController(),
sourceView: sender
)
}
```### Container Style & Display
Use `ContextMenu.Options` to change the appearance of the containing view.
```swift
ContextMenu.shared.show(
sourceViewController: self,
viewController: MenuViewController(),
options: ContextMenu.Options(containerStyle: ContextMenu.ContainerStyle(backgroundColor: .blue)),
sourceView: button
)
```There's plenty more you can customize with `ContextMenu.ContainerStyle`:
- `cornerRadius`: The corner radius of the menu
- `shadowRadius` and `shadowOpacity`: Appearance of the container shadow
- `xPadding`, `yPadding`, `edgePadding`: Padding from the source view and screen edge
- `overlayColor`: The color of the background
- `motionEffect`: Respond to device gyroscope changes, similar to app icons on Springboard.app.If you want more customizations, we will gladly accept a Pull Request!
## Acknowledgements
- Inspiration from [Things 3](https://culturedcode.com/things/)
- Created with ❤️ by [Ryan Nystrom](https://twitter.com/_ryannystrom)