I have a UITextField
within a container view in my UITableViewCell
. I want to bring its container to the very front when the text field is tapped. To clarify: I added a subview to "mask" the background when the text field is tapped, so only the text field is showing. However I am having trouble with some methods i've tried:
self.view.bringSubviewToFront(subview1)
This does not seem to work even if I have a reference to the view in my UIViewController
, I am guessing it is because the view is buried too deep (but i'm not entirely sure)?
self.view.insertSubview(subview1, aboveSubview: maskBackgroundView)
This does bring the subview to the front, but it screws up the constraints I set on the subview.
You should be using the view.hidden
property to control the look, rather than shifting the order. view.hidden = true
hides the view, while false
displays it.
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.