iOS 号召性用语工具提示组件
iOS call to action tooltip component
我正在寻找用 Swift 编写的强大的工具提示组件,它可以让我在特定时刻显示说明或 "call to action" 消息。经过研究,我发现了几个组件,但它们要么缺少我需要的某些功能,要么对我来说并不那么坚固。该组件应该:
- 支持设备方向改变
- 提供委托,这样我就应该知道用户是否关闭了工具提示
- 灵活轻松
可定制
- 与 Cocoapods 集成将是一个优势
谢谢!
我推荐你看看EasyTipView。
EasyTipView is a custom tooltip view written in Swift that can be used
as a call to action or informative tip. It can be presented for any
UIBarButtonItem or UIView subclass. In addition it handles
automatically orientation changes and will always point to the correct
view or item.
要使用 CocoaPods
将 EasyTipView 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'EasyTipView', '~> 0.1.0'
用法:
1) 首先你应该自定义首选项:
var preferences = EasyTipView.Preferences()
preferences.bubbleColor = UIColor(hue:0.58, saturation:0.1, brightness:1, alpha:1)
preferences.textColor = UIColor.darkGrayColor()
preferences.font = UIFont(name: "HelveticaNeue-Regular", size: 10)
preferences.textAlignment = NSTextAlignment.Center
2) 然后调用 showAnimated:forView:withinSuperview:text:preferences:delegate:
方法:
EasyTipView.showAnimated(true,
forView: self.buttonB,
withinSuperview: self.navigationController?.view,
text: "Tip view inside the navigation controller's view. Tap to dismiss!",
preferences: preferences,
delegate: self)
EasyTipViewDelegate
协议定义了一种在关闭 EasyTipView 后在委托上调用的方法。
我正在寻找用 Swift 编写的强大的工具提示组件,它可以让我在特定时刻显示说明或 "call to action" 消息。经过研究,我发现了几个组件,但它们要么缺少我需要的某些功能,要么对我来说并不那么坚固。该组件应该:
- 支持设备方向改变
- 提供委托,这样我就应该知道用户是否关闭了工具提示
- 灵活轻松 可定制
- 与 Cocoapods 集成将是一个优势
谢谢!
我推荐你看看EasyTipView。
EasyTipView is a custom tooltip view written in Swift that can be used as a call to action or informative tip. It can be presented for any UIBarButtonItem or UIView subclass. In addition it handles automatically orientation changes and will always point to the correct view or item.
要使用 CocoaPods
将 EasyTipView 集成到您的 Xcode 项目中,请在您的 Podfile 中指定它:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'EasyTipView', '~> 0.1.0'
用法:
1) 首先你应该自定义首选项:
var preferences = EasyTipView.Preferences()
preferences.bubbleColor = UIColor(hue:0.58, saturation:0.1, brightness:1, alpha:1)
preferences.textColor = UIColor.darkGrayColor()
preferences.font = UIFont(name: "HelveticaNeue-Regular", size: 10)
preferences.textAlignment = NSTextAlignment.Center
2) 然后调用 showAnimated:forView:withinSuperview:text:preferences:delegate:
方法:
EasyTipView.showAnimated(true,
forView: self.buttonB,
withinSuperview: self.navigationController?.view,
text: "Tip view inside the navigation controller's view. Tap to dismiss!",
preferences: preferences,
delegate: self)
EasyTipViewDelegate
协议定义了一种在关闭 EasyTipView 后在委托上调用的方法。