0

I've got an image set as a background in :

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

The question is how to set it's opacity or "alpha". I have tried

colorWithAlphaComponent(0.5)

but it just made the image darker. I want it to be brighter.

J.M
  • 15
  • 3

1 Answers1

0

A way around what you are trying to do would be to add a UIView component on top of the view you want to add brightness to and set the UIView's colour to white or any colour you like and then reduce the alpha of it to something like 0.1 or 0.2 and it should brighten up the image behind it.

RyanM
  • 751
  • 5
  • 20
  • I have tried it but it is the same, I made the alpha of the view: 1, it made the image disappear (only white), then i made it 0.9 it made the image silver then i made it 0.1 it made it dark but visible. – J.M Nov 14 '16 at 08:54
  • What was the color of your view @J.M – RyanM Nov 14 '16 at 09:03
  • white, BTW i knew what i was doing wrong but i faced another problem. I didnt delete the colorWithAlphaComponent(0.5), i deleted it and it worked:) but my text was barely visible – J.M Nov 14 '16 at 09:27
  • Put your text over the view so it's clearly visible @J.M – RyanM Nov 14 '16 at 09:38