大佬教程收集整理的这篇文章主要介绍了ios – UIButton永远不会在Action中触发代码,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
x是UIButton的图像,我已经为按钮添加了相应的操作.然而,当我点击按钮时,它永远不会触发动作中的代码.
这是一些代码:
@IBACtion func CloseProfilePage(sender: AnyObject) { self.removeAnimate(); }
这是用于启动视图控制器的代码:
func collectionView(collectionView: UICollectionView,didSELEctItemATindexPath indexPath: NSIndexPath) { let SELEctedAppointment = self.dayDatasource!.appointmentATindex(indexPath.item); let profilePageViewController = ProfilePageViewController.init(withAppointment: SELEctedAppointment); profilePageViewController.view.frame = self.view.frame self.view.addSubview(profilePageViewController.view) profilePageViewController.didMoveToParentViewController(self) }
该按钮肯定在xib中连接到动作:
当我检查视图层次结构时,按钮顶部没有任何其他内容可以阻止按钮但是会记录点击次数.我在这里假设UIButton中的imageView是可点击的,因为它是按钮的一部分.
图像中的X不是我添加的图像视图,它是UIButton附带的图像视图.话虽如此,我还采取了以下措施:
self.profilePageClosePopUpButton.imageView?.userInteractionEnabled = true;
按钮仍然无法点击.我哪里错了?
以上是大佬教程为你收集整理的ios – UIButton永远不会在Action中触发代码全部内容,希望文章能够帮你解决ios – UIButton永远不会在Action中触发代码所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。