Skip to content

Instantly share code, notes, and snippets.

View imxieyi's full-sized avatar

Yi Xie imxieyi

View GitHub Profile
@imxieyi
imxieyi / ContextMenuView.swift
Created April 25, 2020 20:08
Invoke iOS Context Menu Programmatically
class ContextMenuView: UIView {
var imageView: UIView!
var interaction: UIContextMenuInteraction!
func initSubviews() -> ContextMenuView {
interaction = UIContextMenuInteraction(delegate: self)
addInteraction(interaction)
let gesture = UITapGestureRecognizer(target: self, action: #selector(action(_:)))
addGestureRecognizer(gesture)
return self
@imxieyi
imxieyi / BlendImageView.swift
Created August 1, 2017 18:46
Directly blend image in UIImageView with specific color in XCode Interface Builder
import UIKit
@IBDesignable
open class BlendImageView:UIImageView {
@IBInspectable open var color:UIColor? {
didSet {
if self.image != nil {
self.image = self.image?.image(withTint: color!)
}