I have created UIViewcontroller's custom view via xib file and assign view custom class in storyboard. In custom view I have few subview which shown on some action. I have added also subview in controller's view in storyboard. Now if I bring these controller's subview via this line of code
self.view.bringSubviewToFront(vSubview)
But problem come when I want to bring subview to front that was added in custom view added via xib. I have tried following possible way
self.view.bringSubviewToFront(sideView)
sideView.layer.zPosition = 2
UIApplication.sharedApplication().keyWindow!.bringSubviewToFront(sideView)
but in vain. I have confirmed it that subview I want to bring to front is present in view hierarchy.
Set the tag to subView. Try to get the subview with its tag from superView. Or put a loop on all subviews in self.view
until you get the subView with its tag. Then bring that to front bringSubviewToFront
. Make sure you added the sideView(your subview) in self.view
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.