当你点击它时如何把子视图放到前面?
我有一个约30个子视图的观点。 我想在我的子视图的viewcontroller中添加代码,以便当我点击子视图时,子视图展开以填充屏幕。
我正在使用[self.view setFrame:rect]展开子视图,这工作正常。 问题是其他29个子视图中的一些位于我刚才点击的子视图的上方,所以它们仍然可见。 
 我已经尝试从父bringSubviewToFront使用bringSubviewToFront ,但这似乎没有任何效果。 有没有我可以放在我的子视图的viewcontroller类,使这种情况发生的代码? 
bringSubviewToFront应该工作,只要确保您正确使用它。 用法是。
 [parentView bringSubviewToFront:childView]; 
使用这个代码,即使你不了解superView:
在objective-c中:
 [subview.superview bringSubviewToFront: subview]; 
在迅速:
 subview.superview?.bringSubview(toFront: subview) 
在objective-c中:
 [self.superview bringSubviewToFront: subview]; 
在swift2.3中:
 self.superview!.bringSubviewToFront(subview) 
在swift3.1.1中:
 superview.bringSubview(toFront: subview) 
为了便于使用Swift 3中的扩展
 extension UIView { func bringToFront() { self.superview?.bringSubview(toFront: self) } }