seggy seggy - 1 year ago 95
iOS Question

Repeat image in view horizontally and vertically

i know this question repeat but i cant get sultion

I have this image

And i want view background like this

enter image description here

i have tried all the this

i also try this

self.view.backgroundColor = UIColor(patternImage:
UIImage(named: "backgroundicon.png")!)

Thank you in advance


UIImage(named: "backgroundicon.png")?.draw(in: self.view.bounds)

let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!


self.view.backgroundColor = UIColor(patternImage: image)

Result :

enter image description here

Answer Source

Here is what you need,

self.imageView.image = UIImage(named: "abcd.png")!.resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))

Thats all buddy :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download