您可以找到大量有关如何在mapView上添加注释的示例/库。 但我想知道是否有任何库添加注释到UIImageView。
感谢您的帮助!
答案 0 :(得分:0)
你可以试试这个按钮和视图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
}
}