Commit f730593f by Daniel Dahan

Added FABMenuItemTitleLabelPosition which allows the FABMenu to place its…

Added FABMenuItemTitleLabelPosition which allows the FABMenu to place its FABBMenuItems to either the left or right position of the FABButton.
parent 822bdd70
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
import UIKit import UIKit
@objc(FABMenuItemTitleLabelPosition)
public enum FABMenuItemTitleLabelPosition: Int {
case left
case right
}
@objc(FABMenuDirection) @objc(FABMenuDirection)
public enum FABMenuDirection: Int { public enum FABMenuDirection: Int {
case up case up
...@@ -42,6 +48,9 @@ open class FABMenuItem: View { ...@@ -42,6 +48,9 @@ open class FABMenuItem: View {
/// A reference to the titleLabel. /// A reference to the titleLabel.
open let titleLabel = UILabel() open let titleLabel = UILabel()
/// The titleLabel side.
open var titleLabelPosition = FABMenuItemTitleLabelPosition.left
/// A reference to the fabButton. /// A reference to the fabButton.
open let fabButton = FABButton() open let fabButton = FABButton()
...@@ -75,12 +84,6 @@ open class FABMenuItem: View { ...@@ -75,12 +84,6 @@ open class FABMenuItem: View {
addSubview(titleLabel) addSubview(titleLabel)
} }
} }
open var titleLabelSide : labelSide = .right
public enum labelSide {
case left
case right
}
} }
extension FABMenuItem { extension FABMenuItem {
...@@ -93,7 +96,7 @@ extension FABMenuItem { ...@@ -93,7 +96,7 @@ extension FABMenuItem {
titleLabel.height += interimSpace / 2 titleLabel.height += interimSpace / 2
titleLabel.y = (height - titleLabel.height) / 2 titleLabel.y = (height - titleLabel.height) / 2
switch (titleLabelSide) { switch titleLabelPosition {
case .left: case .left:
titleLabel.x = -titleLabel.width - interimSpace titleLabel.x = -titleLabel.width - interimSpace
case .right: case .right:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment