ios/swift - Putting a subview behind the superView?

120 Views Asked by At

I have a TraceView which draws a bunch of stuff in the draw(rect) method, and I have AxisView which is added as a subview to the TraceView. The TraceView also draws a bunch of stuff in its own draw(rect) method. The problem is that the stuff that I draw on the AxisView is showing up on top of the stuff of the I have drawn on the TraceView. Even after I call self.sendSubview(toBack: axisView), where self is my TraceView isntance.

Is there any way to fix this without having to redo the layout structure?

1

There are 1 best solutions below

0
rob mayoff On

No, you cannot fix this without changing your view (or layer) hierarchy. A view's content always appears in front of the content of its ancestors.