Renders a tiled image in a view. Also renders in the storyboard.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBDesignable | |
class TiledImageView:UIView { | |
@IBInspectable var image:UIImage? | |
override func draw(_ rect: CGRect) { | |
guard let image = image else {return} | |
UIColor(patternImage: image).setFill() | |
let path = UIBezierPath(rect: rect) | |
path.fill() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment