I have some difficulties in Swift, Xcode I have drawn UIView which has transparent background and I need to calculate the percentage of drawn area in UIView, any ideas? I only know the way by reviewing each cgpoint and getting the value of alpha
Asked
Active
Viewed 133 times
1 Answers
0
Here are the steps to do this :
- Go through the each pixel of the UIView
- calculate colour of that pixel
- Then compare that colour to Black colour Here is the example for retrieving the colour from the pixel : How to get the color of a pixel in an UIView?
-
Thanks, I was planning to do the same, but I have around 100 Views, it may take quite long, what do you think? – Berdikhan Satenov Feb 10 '15 at 03:47
-
cant say actual . But depends on processor . But you really have 100 views ? that means 100 screens ? – V-Xtreme Feb 10 '15 at 03:49
-
Yes, I have 100 pages of pdf file – Berdikhan Satenov Feb 10 '15 at 04:47