Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kenanatmaca/kactionmenu
Like to iOS 3D touch menu
https://github.com/kenanatmaca/kactionmenu
animation ios ios-swift ios-ui menu swift touchscreen
Last synced: about 1 month ago
JSON representation
Like to iOS 3D touch menu
- Host: GitHub
- URL: https://github.com/kenanatmaca/kactionmenu
- Owner: KenanAtmaca
- License: mit
- Created: 2019-08-18T19:54:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-21T09:06:46.000Z (over 5 years ago)
- Last Synced: 2024-11-15T19:49:43.482Z (about 2 months ago)
- Topics: animation, ios, ios-swift, ios-ui, menu, swift, touchscreen
- Language: Swift
- Homepage:
- Size: 16.6 KB
- Stars: 23
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KActionMenu
## Requirements
- Xcode 9.0 +
- iOS 11.0 or greater## Installation
### CocoaPods
1. Install [CocoaPods](http://cocoapods.org)
2. Add this repo to your `Podfile````ruby
platform :ios, '11.0'target 'ProjectName' do
use_frameworks!
pod 'KActionMenu'
end
```3. Run `pod install`
4. Open up the new `.xcworkspace` that CocoaPods generated
5. Whenever you want to use the library: `import KActionMenu`### Manually
1. Simply download the `KActionMenu` source files and import them into your project.
## Usage
```Swift
import UIKitclass ViewController: UIViewController {
@IBOutlet weak var bgImageView: UIImageView!
var menu:KActionMenu!override func viewDidLoad() {
super.viewDidLoad()
bgImageView.addGestureRecognizer(UILongPressGestureRecognizer(target: self, action: #selector(longPressAction)))
menu = KActionMenu(rootView: self.view) // 1.
menu.view.table.actionDelegate = self
menu.view.screenDelegate = self
menu.setMenuStyle(.light) // .light, .dark
}
@objc func longPressAction(gesture: UILongPressGestureRecognizer) {
let location = gesture.location(in: bgImageView)
menu.show(items: [("Follow", UIImage(named: "add")), ("Camera", UIImage(named: "cam")), ("Share", UIImage(named: "share")), ("Like", UIImage(named: "like"))], position: CGPoint(x: location.x, y: location.y), animation: .scale) // 2.
}
}extension ViewController: KActionDelegate, KActionScreenDelegate {
func didCloseScreen() {
print(" - Closed - ")
}
func touchItem(name: String, index: Int) {
print(name, index)
self.menu.view.close()
}
}
```## License
Usage is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.