IOS Auxiliary touch screen with black patches

I have a UITableView with every UITableViewCell having a black card similar to a UIView background. Black cards are not completely opaque, but instead have an alpha of 0.6. Everything looks great when I move the scroll up and down, no problem.

What happens when I move the Assistive Touch to a UITableView. The secondary Touch simply leaves black spots around where it was moved, and black spots remain until I scroll through the UITableView again.

Has anyone else encountered such a problem before? Is there any work around / hack to avoid this?

Optional: when I try to take a screenshot, it is cleared.

This is what happens when I move the Assistive Touch around.

This is what happens when I move the Assistive Touch around.

Here's how it should look.

Here's how it should look.

A snippet of code regarding how I set the background color and alpha for the cells in the table.

override func awakeFromNib() { super.awakeFromNib() // Initialization code self.selectionStyle = .none self.backgroundColor = UIColor.clear self.background.backgroundColor = UIColor.black self.background.alpha = 0.6 background.layer.backgroundColor = CGColor(colorSpace: CGColorSpaceCreateDeviceRGB(), components: [0.0, 0.0, 0.0, 0.6]) background.layer.masksToBounds = true background.layer.shadowOffset = CGSize(width: -1, height: 1) background.layer.shadowOpacity = 0.2 self.contentView.sendSubview(toBack: background) } 
+5
source share
1 answer

Remove this line from your code and see if it works.

 background.layer.backgroundColor = CGColor(colorSpace: CGColorSpaceCreateDeviceRGB(), components: [0.0, 0.0, 0.0, 0.6]) 

It’s possible what happens when your background alpha and alpha touch pad overlap and os tries to recalculate the color of your presentation and it messes up the color of the presentation. So try specifying your color and alpha for the view instead of the presentation layer using the following code.

  self.background.backgroundColor = UIColor.black self.background.alpha = 0.6 
+1
source

Source: https://habr.com/ru/post/1266400/


All Articles