Readme content will be expressed in both English and Chinese.
内容将会用英语和中文进行表述.
========= Easy call / dismiss Action menu bar like
简单一行代码 呼出/隐藏 如上图的 动作菜单
- Manualable define action
- interact with UIView
- available on iOS
- delegate-able reformed
- implement with Swift
实现的封装,包括特性:
- 完全自定义动作
- 可以和UIView等控件的交互
- 在iOS可用
- 封装了一个代理
- 用Swift实现
init : 构造方法
convenience public init(actions:[UIMenuItem], direction: UIMenuControllerArrowDirection?, inView: UIView)
delegate : 代理
public weak var delegate: ActionMenuDelegate?
show : 呼出
public func show(animated animated: Bool, handler completion: (Void) -> Void) -> Void
dismiss : 隐藏
public func dismiss(animated animated: Bool, handler completion: (Void) -> Void) -> Void
life cycle control : 生命周期
func actionMenuDidDismissed(menu: ActionMenu)
override those functions in UIView or Controller need to be , extension contains the example of override implements
在UIView 或者 Controller 里面实现 ActionableProtocol 必须重写的函数 , 在扩展里面有写如何实现的例子
required, must be override implement : 必须在对应类里面实现
func canPerformAction(action: Selector, withSender sender: AnyObject?) -> Bool
required, must be override implement : 必须在对应类里面实现
func canBecomeFirstResponder() -> Bool
HOW TO USE :
- with Code: use init method
- Storyboard or XIB : change label object sub class to "ActionLabel" with module "ActionMenu"
look into this class to find "Actionable Protocol" is Inplemented inside. Which provide an example of how to funtion objects with "ActionMenu" with sub-class of UIView
在内部实现了 ActionableProtocol 和点击手势. 查看里面的具体实现可以了解Actionable Protocol在UIView的自类里面是如何被封装的
cut : 剪切
func cutText()
paste : 粘贴
func pasteText()
copy : 复制
func copyText()red : 改变文字颜色-红色
func red()
blue : 改变文字颜色-蓝色
func blue()
green : 改变文字颜色-绿色
func green()
Just Drag #framework/ActionMenu.xcodeproj# to your project or xcworkspace
把 ActionMenu.xcodeproj 拖进 项目或者工作台 去就行了
if you have any question,contact me.
有问题找大哥
email:xxvk@outlook.com
wechat:phrekn
github: xxvk
website: reformation.tech