简体   繁体   English

Swift:UIButton不可点击的重叠视图

[英]Swift: UIButton un-clickable overlapping views

when I'm unwinding a segue by clicking on a button with a cross image which is 1/4th inside a UIView and 3/4th outside the UIView now when I press on button the part which is inside the UIView then unwind segue works but if I click outside of UIView then it does not works. 现在,当我单击带有交叉图像的按钮来平移segue时,当我按下按钮时,该交叉图像在UIView内 1/4处,在UIView外部3/4处,则当我按下按钮时,在UIView内的部分然后松开segue起作用,但是如果我在UIView之外单击,但它不起作用。

点击这里查看图片

As you can see from above image if I click inside the blue line then other view controller opens and If I click outside blue line of cross button the unwinding of segue does't work, why? 从上图可以看到,如果我在蓝线内单击,则其他视图控制器将打开,如果我在十字按钮的蓝线外单击,segue的展开将不起作用,为什么?

You can View the Video 您可以观看视频

 <a href="https://imgflip.com/gif/24bh0k"><img src="https://i.imgflip.com/24bh0k.gif" title="made at imgflip.com"/></a> 

The cross button seems to be inside the card view rather than superview. 叉号按钮似乎位于卡片视图内部,而不是超级视图。 Put the button inside superview, over the card view but outside the card view. 将按钮放在超级视图内,卡片视图上方,但卡片视图之外。

Do something like this 做这样的事情 在此处输入图片说明

在此处输入图片说明

take the button up on the view and set its constraints properly . 将按钮放在视图上并正确设置其约束。 May be your problem will resolved. 可能是您的问题会解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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