2016-12-06 128 views
-1

您可以找到很多关于如何在mapView中添加注释的示例/库。 但我想知道是否有任何库添加注释到UIImageView。将注释添加到UIImageView

感谢您的帮助!

回答

0

你可以试试这个按钮和视图https://github.com/malcommac/CMPopTipView它的作品就像一个魅力! (这个代码是为一个按钮,但它与UIGestureRecognizer的图像视图相同)

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 
} 
} 
+1

是的你说得对!更新! –