Put subviews UIView in front of your CALayer?

Is it possible? Basically, I want my UIView to be a view, and this view should be in front of the view layer (more precisely, in front of the specified layer border).

Of course, I could achieve the effect I want by creating two subviews of the viewview, one on top of the other. But I would rather avoid this if possible.

+7
source share
2 answers

I have been looking for this for a while; I do not believe that this is possible. I solved the problem, as you are hinting, by adding a subview and a parent to the same container supervisor. Then it’s just a matter of ordering two subzones, so your submission is above the other and its border.

+4
source

I solved this with a segue animation where I need the sourceViewController to be in front of the destinationViewController. I had to remove sourceViewController in order to reinstall it. My code is as follows:

- (void) perform { UIViewController *sourceViewController = (UIViewController *) self.sourceViewController; UIViewController *destinationViewController = (UIViewController *) self.destinationViewController; UIView *parent = sourceViewController.view.superview; [sourceViewController.view removeFromSuperview]; [parent addSubview: destinationViewController.view]; [parent addSubview:sourceViewController.view]; // Perform animation stuffs... } 
+1
source

All Articles