Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d9e9afcc8b | |||
| 9b0d1eded6 | |||
| ec8c1424b3 | |||
| dd75a83797 | |||
| 774cb1cf64 | |||
| c4cf9482bf | |||
| b64cda5541 | |||
| 06df7ff2b1 | |||
| ea82aeff84 | |||
| 69b65edc06 | |||
| 1604f89c72 | |||
| d8d7eaf528 | |||
| 62ad8b528f | |||
| 9a21e80ae8 | |||
| 3f202ec9cf | |||
| a4504a1502 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'CircleMenu'
|
||||
s.version = '2.0.1'
|
||||
s.version = '2.0.4'
|
||||
s.summary = 'Amazing animation with buttons'
|
||||
s.homepage = 'https://github.com/Ramotion/circle-menu'
|
||||
s.license = 'MIT'
|
||||
|
||||
@@ -264,12 +264,12 @@
|
||||
TargetAttributes = {
|
||||
8403F5781CFF2C2E007D0BD1 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 0900;
|
||||
};
|
||||
84F248B21C58E65F008F12C1 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
DevelopmentTeam = 34MUF9YXTA;
|
||||
LastSwiftMigration = 0800;
|
||||
LastSwiftMigration = 0900;
|
||||
};
|
||||
84F248C61C58E65F008F12C1 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
@@ -428,7 +428,8 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.CircleMenu;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = On;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -452,7 +453,8 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.CircleMenu;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = On;
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -502,6 +504,7 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -541,6 +544,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 4.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
@@ -557,7 +561,8 @@
|
||||
OTHER_SWIFT_FLAGS = "";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = On;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -573,7 +578,8 @@
|
||||
OTHER_SWIFT_FLAGS = "";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.dev;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = On;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -585,7 +591,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.CircleMenuTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircleMenu.app/CircleMenu";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircleMenuDemo.app/CircleMenuDemo";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -597,7 +603,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.CircleMenuTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircleMenu.app/CircleMenu";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircleMenuDemo.app/CircleMenuDemo";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -11,10 +11,10 @@ import UIKit
|
||||
extension UIColor {
|
||||
static func color(_ red: Int, green: Int, blue: Int, alpha: Float) -> UIColor {
|
||||
return UIColor(
|
||||
colorLiteralRed: Float(1.0) / Float(255.0) * Float(red),
|
||||
green: Float(1.0) / Float(255.0) * Float(green),
|
||||
blue: Float(1.0) / Float(255.0) * Float(blue),
|
||||
alpha: alpha)
|
||||
red: 1.0 / 255.0 * CGFloat(red),
|
||||
green: 1.0 / 255.0 * CGFloat(green),
|
||||
blue: 1.0 / 255.0 * CGFloat(blue),
|
||||
alpha: CGFloat(alpha))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ class ViewController: UIViewController, CircleMenuDelegate {
|
||||
super.viewDidLoad()
|
||||
|
||||
// add button
|
||||
|
||||
// let button = CircleMenu(
|
||||
// frame: CGRect(x: 200, y: 200, width: 50, height: 50),
|
||||
// normalIcon:"icon_menu",
|
||||
@@ -63,7 +62,7 @@ class ViewController: UIViewController, CircleMenuDelegate {
|
||||
// set highlited image
|
||||
let highlightedImage = UIImage(named: items[atIndex].icon)?.withRenderingMode(.alwaysTemplate)
|
||||
button.setImage(highlightedImage, for: .highlighted)
|
||||
button.tintColor = UIColor.init(colorLiteralRed: 0, green: 0, blue: 0, alpha: 0.3)
|
||||
button.tintColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.3)
|
||||
}
|
||||
|
||||
func circleMenu(_ circleMenu: CircleMenu, buttonWillSelected button: UIButton, atIndex: Int) {
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
import UIKit
|
||||
|
||||
// MARK: helpers
|
||||
|
||||
|
||||
func Init<Type>(_ value: Type, block: (_ object: Type) -> Void) -> Type {
|
||||
block(value)
|
||||
return value
|
||||
@@ -276,7 +274,7 @@ open class CircleMenu: UIButton {
|
||||
|
||||
// MARK: actions
|
||||
|
||||
func onTap() {
|
||||
@objc func onTap() {
|
||||
if buttonsIsShown() == false {
|
||||
let platform = createPlatform()
|
||||
buttons = createButtons(platform: platform)
|
||||
@@ -290,7 +288,7 @@ open class CircleMenu: UIButton {
|
||||
tapRotatedAnimation(0.3, isSelected: isShow)
|
||||
}
|
||||
|
||||
func buttonHandler(_ sender: CircleMenuButton) {
|
||||
@objc func buttonHandler(_ sender: CircleMenuButton) {
|
||||
guard let platform = self.platform else { return }
|
||||
|
||||
delegate?.circleMenu?(self, buttonWillSelected: sender, atIndex: sender.tag)
|
||||
@@ -306,10 +304,10 @@ open class CircleMenu: UIButton {
|
||||
}
|
||||
|
||||
if let buttons = buttons {
|
||||
circle.fillAnimation(duration, startAngle: -90 + Float(360 / buttons.count) * Float(sender.tag)) { [weak self] _ in
|
||||
circle.fillAnimation(duration, startAngle: -90 + Float(360 / buttons.count) * Float(sender.tag)) { [weak self] in
|
||||
self?.buttons?.forEach { $0.alpha = 0 }
|
||||
}
|
||||
circle.hideAnimation(0.5, delay: duration) { [weak self] _ in
|
||||
circle.hideAnimation(0.5, delay: duration) { [weak self] in
|
||||
if self?.platform?.superview != nil { self?.platform?.removeFromSuperview() }
|
||||
}
|
||||
|
||||
@@ -476,11 +474,11 @@ open class CircleMenu: UIButton {
|
||||
|
||||
internal extension Float {
|
||||
var radians: Float {
|
||||
return self * (Float(180) / Float(M_PI))
|
||||
return self * (Float(180) / Float.pi)
|
||||
}
|
||||
|
||||
var degrees: Float {
|
||||
return self * Float(M_PI) / 180.0
|
||||
return self * Float.pi / 180.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ internal class CircleMenuButton: UIButton {
|
||||
init(size: CGSize, platform: UIView, distance: Float, angle: Float = 0) {
|
||||
super.init(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: size))
|
||||
|
||||
self.backgroundColor = UIColor(colorLiteralRed: 0.79, green: 0.24, blue: 0.27, alpha: 1)
|
||||
self.backgroundColor = UIColor(red: 0.79, green: 0.24, blue: 0.27, alpha: 1)
|
||||
self.layer.cornerRadius = size.height / 2.0
|
||||
|
||||
let aContainer = createContainer(CGSize(width: size.width, height:CGFloat(distance)), platform: platform)
|
||||
@@ -158,7 +158,7 @@ internal extension CircleMenuButton {
|
||||
|
||||
internal func hideAnimation(distance: Float, duration: Double, delay: Double = 0) {
|
||||
guard let heightConstraint = (self.container?.constraints.filter {$0.identifier == "height"})?.first else {
|
||||
fatalError()
|
||||
return
|
||||
}
|
||||
|
||||
heightConstraint.constant = CGFloat(distance)
|
||||
|
||||
@@ -60,7 +60,7 @@ internal class CircleMenuLoader: UIView {
|
||||
arcCenter: CGPoint(x: radius, y: radius),
|
||||
radius: CGFloat(radius) - strokeWidth / 2.0,
|
||||
startAngle: CGFloat(0),
|
||||
endAngle:CGFloat(M_PI * 2),
|
||||
endAngle:CGFloat.pi * 2,
|
||||
clockwise: true)
|
||||
|
||||
let circle = Init(CAShapeLayer()) {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[](https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu-logo)
|
||||

|
||||

|
||||
|
||||
# CircleMenu
|
||||
[](http://twitter.com/Ramotion)
|
||||
[](https://cocoapods.org/pods/CircleMenu)
|
||||
@@ -10,16 +12,24 @@
|
||||
|
||||
## About
|
||||
This project is maintained by Ramotion, Inc.<br>
|
||||
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br><br>**Looking for developers for your project?** [[▶︎CONTACT OUR TEAM◀︎](http://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu-contact-us/#Get_in_Touch)]
|
||||
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br>
|
||||
|
||||
[](https://dribbble.com/shots/2534780-Circle-Menu-Swift-Open-Source)
|
||||
**Looking for developers for your project?**<br>
|
||||
This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
|
||||
|
||||
<a href="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu-contact-us/#Get_in_Touch">
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> <br>
|
||||
|
||||
|
||||
The [iPhone mockup](https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu) available [here](https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu).
|
||||
The [iPhone mockup](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu).
|
||||
|
||||
## Try this UI control in action
|
||||
|
||||
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=gthb-circle-menu&mt=8" > <img src="https://github.com/Ramotion/navigation-stack/raw/master/Download_on_the_App_Store_Badge_US-UK_135x40.png" width="170" height="58"></a>
|
||||
|
||||
## Requirements
|
||||
|
||||
- iOS 8.0+
|
||||
- iOS 9.0+
|
||||
- Xcode 7.3
|
||||
|
||||
## Installation
|
||||
@@ -48,7 +58,7 @@ github "Ramotion/circle-menu"
|
||||
3) Use delegate method to configure buttons
|
||||
|
||||
```swift
|
||||
func circleMenu(circleMenu: CircleMenu, willDisplay button: CircleMenuButton, atIndex: Int)
|
||||
func circleMenu(circleMenu: CircleMenu, willDisplay button: UIButton, atIndex: Int)
|
||||
```
|
||||
|
||||
4) Use properties to confiure CircleMenu
|
||||
@@ -78,13 +88,13 @@ view.addSubview(button)
|
||||
|
||||
```swift
|
||||
// configure buttons
|
||||
optional func circleMenu(circleMenu: CircleMenu, willDisplay button: CircleMenuButton, atIndex: Int)
|
||||
optional func circleMenu(circleMenu: CircleMenu, willDisplay button: UIButton, atIndex: Int)
|
||||
|
||||
// call before animation
|
||||
optional func circleMenu(circleMenu: CircleMenu, buttonWillSelected button: CircleMenuButton, atIndex: Int)
|
||||
optional func circleMenu(circleMenu: CircleMenu, buttonWillSelected button: UIButton, atIndex: Int)
|
||||
|
||||
// call after animation
|
||||
optional func circleMenu(circleMenu: CircleMenu, buttonDidSelected button: CircleMenuButton, atIndex: Int)
|
||||
optional func circleMenu(circleMenu: CircleMenu, buttonDidSelected button: UIButton, atIndex: Int)
|
||||
|
||||
// call upon cancel of the menu
|
||||
optional func menuCollapsed(circleMenu: CircleMenu)
|
||||
@@ -94,8 +104,18 @@ optional func menuCollapsed(circleMenu: CircleMenu)
|
||||
|
||||
Circle menu is released under the MIT license.
|
||||
See [LICENSE](./LICENSE) for details.
|
||||
<br>
|
||||
|
||||
## Folow us
|
||||
# Get the Showroom App for iOS to give it a try
|
||||
Try this UI component and more like this in our iOS app. Contact us if interested.
|
||||
|
||||
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=circle-menu&mt=8" >
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
|
||||
<a href="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=circle-menu-contact-us/#Get_in_Touch">
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
Follow us for the latest updates<br>
|
||||
[](https://twitter.com/intent/tweet?text=https://github.com/ramotion/circle-menu)
|
||||
[](https://twitter.com/ramotion)
|
||||
|
||||
Reference in New Issue
Block a user