Does calling [view setNeedsDisplay] for a view behind another semi-transparent view not invoke drawRect:?

StackOverflow https://stackoverflow.com/questions/12612998

Question

I have two views:

View A with alpha 1.0
View B with alpha 0.5

Both are subviews, with view B added as a subview after view A which implies that the opaque view A is partially visible through the semi-transparent view B.

When I call setNeedsDisplay on both views, only view B's drawRect is invoked.

I am aware that setNeedsDisplay doesn't immediately invoke drawRect so I guess if A was completely invisible, this would make sense.

When I can see part of view A through B, why is A's drawRect still not get invoked? Maybe I didn't understand the documentation correctly?

Was it helpful?

Solution

To answer my own question - drawRect is not invoked in this case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top