CircleAnimatedMenu 1.0.5

CircleAnimatedMenu 1.0.5

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2017年2月
SwiftSwift 版本3.0
SPM支持 SPM

honcharenko13 维护。



  • Redwerk

CircleAnimatedMenu

enter image description here

CircleAnimatedMenu - 方便的自定义菜单,可用于显示和选择不同类别。选择可以通过滑动菜单中心或仅通过触摸章节来完成。

要求

  • iOS 9.0
  • Xcode 8.0+

安装

CircleAnimatedMenu 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile:

pod "CircleAnimatedMenu"

使用方法

使用 Storyboard

1) 创建一个新的继承自 CircleAnimatedMenu 的 UIView

2) 在您的视图控制器中创建 IBOutlet 属性

@IBOutlet weak var testMenu: CircleAnimatedMenu!

3) 在 IB 中将通过 CircleAnimatedMenu 连接到 IBOutlet

4) 构建 Array of tuples。每个元组应包含两个 String 值,第一个值是图像名称,第二个是分类文本。这可以在 func viewDidLoad 中写入。

testMenu.tuplesArray = [("facebook", "Facebook"), ("insta", "Instagram"), ("twit", "Twitter"),
("link", "LinkedIn"), ("googlePlus", "GooglePlus"), ("github", "GitHub")];

5) 将委托设置为获取选中章节的索引和文本。

testMenu.delegate = self
程序化使用
let menuFrame = CGRect(x: 0, y: 0, width: 220, height: 220)
let testMenu = CircleAnimatedMenu(menuFrame: menuFrame, dataArray: [("facebook", "Facebook"), ("insta", "Instagram"), ("twit", "Twitter"), ("link", "LinkedIn"), ("googlePlus", "GooglePlus"), ("github", "GitHub")])
testMenu.delegate = self
self.view.addSubview(testMenu)
委托方法
// to get text and index of selected section
func sectionSelected(text: String, index: Int)
公共属性
// Inner radius of menu
@IBInspectable public var innerRadius: CGFloat = 30

// Outer radius of menu
@IBInspectable public var outerRadius: CGFloat = 75

// Width of line between sections and central circle
@IBInspectable public var closerBorderWidth: CGFloat = 2

// Width of border menu
@IBInspectable public var farBorderWidth: CGFloat = 0 

// Menu fill color
@IBInspectable public var menuFillColor: UIColor = .darkGray

// Menu background color - color of layer that lies under section layers and inner circle layer
@IBInspectable public var menuBackgroundColor: UIColor = .white

// Inner circle color
@IBInspectable public var innerCircleColor: UIColor = .darkGray

// Color of section after selection
@IBInspectable public var highlightedColor: UIColor = .blue

// Color of line between slices and central circle
@IBInspectable public var closerBorderColor: UIColor = .white

// Border menu color
@IBInspectable public var farBorderColor: UIColor = .white

// Sections stroke color
@IBInspectable public var sectionsStrokeColor: UIColor = .white

// Text color
@IBInspectable public var textColor: UIColor = .white

// Shadow color
@IBInspectable public var shadowColor: UIColor = .lightGray 

// Shadow radius
@IBInspectable public var menuShadowRadius: CGFloat = 15

// Duration it takes to sections to expand.
public var animDuration: Double = 1.0

// Menu width line
@IBInspectable public var menuWidthLine: CGFloat = 0

// Text font - to set font and font size of text
@IBInspectable public var titleFont: UIFont = UIFont.systemFont(ofSize: 13)

// Image size value
public var imageSize: CGFloat = 30

// Default highlighted section index. Set it if you want to highlight some section at start
@IBInspectable public var defaulHighlightedtSectionIndex: Int = -1 

// set animation state. Default - true
public var animated: Bool = true 

// Data
public var tuplesArray: [(String, String)] = []

// You can set highlighted colors array if you want to highlight each section separately
public var highlightedColors: [UIColor] = []

示例

要运行示例项目,请首先克隆仓库,然后在 Example 目录中运行 pod install

enter image description here

许可证

CircleAnimatedMenu 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。