ChatMenu 1.1.0

ChatMenu 1.1.0

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

Tangent 维护。



ChatMenu 1.1.0

  • 作者:
  • Tangent



ChatMenu

要求

  • iOS 9.0 或更高版本
  • Swift 3.0

演示

在Xcode中运行 Sample 项目,以查看 ChatMenu 的实际效果。

使用方法

ChatMenu 非常简单易用,您只需要调用一个函数

/// Show a menu on a particular chat bubble view, with an action sheet
/// attached to it.
///
/// - Parameters:
///   - bubbleView: Chat bubble view.
///   - direction: The direction in which the bubble view is located.
///   - actions: Actions of the action sheet in menu.
///   - items: Items to show on the bubble view, such as emoji.
///   - dismissCallback: Called when menu will dismiss.
///   - completedDismissCallback: Called when menu did dismiss.
static func show(on bubbleView: UIView,
                     direction: Direction,
                     actions: [Action],
                     items: [BubbleItem],
                     dismissCallback: (() -> ())? = nil,
                     completedDismissCallback: (() -> ())? = nil)

示例使用

// Items
let emojis = "😀👍👎❤️🎉".characters.map { String($0) }
let items = emojis.map { emoji in
	ChatMenu.BubbleItem(title: emoji, image: nil, action: { 
		print("did Selected" + emoji)
	})
}

// Actions
let cameraAction = ChatMenu.Action(title: "Camera", tintColor: .green) {
	print("Open Camera")
}
let albumAction = ChatMenu.Action(title: "Album", tintColor: .orange) {
	print("Open Album")
}
let cancelAction = ChatMenu.Action(style: .cancel, title: "Cancel", tintColor: .red) { 
	print("Cancel")
}
let actions = [cameraAction, albumAction, cancelAction]

// Show
ChatMenu.show(on: bubbleView,
              direction: .left,
              actions: actions,
              items: items,
              dismissCallback: { print("ChatMenu will dismiss") },
              completedDismissCallback: { print("ChatMenu did dismiss") })

许可证

MIT 许可证 (MIT)