我以编程方式创建了一个视图,就像从顶部弹出的弹出窗口,其中包含一些文本和图像!尝试点击以编程方式创建的视图时发生错误swift 3
alert = UIView(frame: CGRect(x: 0, y: 0, width: self.frame.width , height: 0))
alert?.frame.origin.y = (textLable?.frame.height)!
alert?.frame.size.height = (textLable?.frame.height)!
alert?.backgroundColor = self.arrayOptions.colorBackground
,然后我想一个UITapGestureRecognizer添加到设置FUNC内像这样的观点,即是所谓的初始化。
let tap = UITapGestureRecognizer(target: self, action: #selector(self.teste))
tap.numberOfTapsRequired = 1
alert?.addGestureRecognizer(tap)
IM添加像这样的观点在一个UITableViewController:
self.popView = PopupView(frame: CGRect(x: 0 , y: 0 , width:self.view.frame.width, height: 0), with: PopUpOptions.error, originY: 0,description:"blablabla")
self.view.addSubview(self.popView!)
但是,当我点击后没有任何反应,但是当我点击重复一遍又一遍地出现此错误时的观点:
< _UISystemGestureGateGestureRecognizer:0x174186f50>:手势:失败 在下次触摸前接收系统手势状态通知
但我似乎无法找到答案,任何人都可以帮助我! 谢谢!
这里是GitHub的链接https://github.com/Coimbraa/AlertsPopup_framework我的框架
你是否在'PopupView'函数中创建了'alert'和'tap',然后'alert?.addGestureRecognizer(tap)'?所有在一个单元格子类中?而'self.teste'也是*该类内的func?并且'self.view.addSubview(self.popView!)'在该类中也是***?它可能会帮助,如果你只是发布完整的类,所以我们可以看到你何时何地运行这些代码... – DonMag
虐待离开这里gitHub链接到我的项目https://github.com/Coimbraa/AlertsPopup_framework即时尝试建立一个框架和从主项目实施该框架 – mastercoder