简体   繁体   中英

Disable Root view interaction and Enable subview interaction at a time

I am developing an app.I have used a view and added a subview to that.My question is when click on a button in root view I added a sub view(tableview). And when i select any row in table view.then removing the view from super view.when I added the subview to root view..I want to disable root view interaction without effecting the subviews interaction. Is is possible?

放置一个透明或半透明的叠加视图(Alpha = 0到0.5),在根视图的顶部有frame = rootView.frame,然后将你的表视图放入这个叠加视图,没有触摸事件可以通过,呵呵。

The value of userInteractionEnabled affects all subviews of the view it's set to, so no, not in the way you're thinking. If you wish to disable touch events for a view, subclass it and override - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event to forward it's touches to the other 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM