【发布时间】:2017-04-20 19:26:52
【问题描述】:
您会发现大量关于如何在 mapView 上添加注释的示例/库。 但我想知道是否有任何库可以向 UIImageView 添加注释。
感谢您的帮助!
【问题讨论】:
标签: ios iphone swift uiimageview mkannotation
您会发现大量关于如何在 mapView 上添加注释的示例/库。 但我想知道是否有任何库可以向 UIImageView 添加注释。
感谢您的帮助!
【问题讨论】:
标签: ios iphone swift uiimageview mkannotation
你可以试试这个按钮和视图https://github.com/malcommac/CMPopTipView它就像一个魅力! (此代码用于按钮,但与 UIGestureRecognizer 的 uimageview 相同)
class ViewController: UIViewController, SwiftPopTipViewDelegate {
var roundRectButtonPopTipView: SwiftPopTipView?
@IBAction func buttonAction(_ sender: UIButton) {
// Toggle popTipView when a standard UIButton is pressed
if let _ = roundRectButtonPopTipView {
// Dismiss
roundRectButtonPopTipView?.dismissAnimated(true)
roundRectButtonPopTipView = nil
} else {
roundRectButtonPopTipView = SwiftPopTipView(message: "My message")
roundRectButtonPopTipView?.delegate = self
roundRectButtonPopTipView?.popColor = UIColor.lightGray
roundRectButtonPopTipView?.textColor = UIColor.darkText
roundRectButtonPopTipView?.presentPointingAtView(sender as! UIView, containerView: view, animated: true)
}
}
//MARK: - SwiftPopTipViewDelegate methods
func popTipViewWasDismissedByUser(popTipView: SwiftPopTipView) {
// User can tap SwiftPopTipView to dismiss it
roundRectButtonPopTipView = nil
}
}
【讨论】: