Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bringing a subview to be in front of all other views

I am working on integrating an ad provider into my app currently. I wish to place a fading message in front of the ad when the ad displays but have been completely unsuccessful.

I made a function which adds a subview to my current view and tries to bring it to the front using

[self.view bringSubviewToFront:mySubview] 

The function fires on notification that the ad loaded (the notification is from the adprovider's SDK). However, my subview does not end up in front of the ad. I imagine this is made purposely difficult by the ad provider, but I wish to do it regardless. I am currently discussing with the provider whether or not this can be allowed. But for the time being, I just want to see if it's even possible.

Is there anyway I can force a subview of mine to be the top-most view such that it will not be obstructed by anything?

like image 253
Mark S Avatar asked Nov 01 '12 17:11

Mark S


People also ask

What does Documentation call the parent view that's embedding the other view?

Embedding one view inside another creates a containment relationship between the host view (known as the superview) and the embedded view (known as the subview).

What is Addsubview?

Adds a view to the end of the receiver's list of subviews.

How do I get Subviews in UIView Swift?

If you need a quick way to get hold of a view inside a complicated view hierarchy, you're looking for viewWithTag() – give it the tag to find and a view to search from, and this method will search all subviews, and all sub-subviews, and so on, until it finds a view with the matching tag number.


1 Answers

try this:

self.view.layer.zPosition = 1; 
like image 176
daniel kilinskas Avatar answered Nov 16 '22 00:11

daniel kilinskas