大佬教程收集整理的这篇文章主要介绍了ios – UITapGestureRecognizer发送者是手势,而不是ui对象,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@IBACtion func handleGesture(sender: UIGestureRecognizer) { if sender.state == UIGestureRecognizerState.began { let labelTap1=UITapGestureRecognizer(target: self,action: "labelTapped:") let alertController = UIAlertController(title: "**I want this to be the title of the button**",@R_772_8798@ge: "This is the description of the function you pressed",preferredStyle: UIAlertControllerStyle.Alert) alertController.addAction(UIAlertAction(title: "OK",style: UIAlertActionStyle.Default,handler: nil)) self.presentViewController(alertController,animated: true,completion: nil) } }
正如您所看到的,UIAlertController出现了,我希望标题显示当前标题的按钮.如果此函数的发件人是按钮,我可以使用sender.currenttitle调用它.当函数的发送者是手势时,如何获得与手势相关联的按钮的标题.
我在目标C中看过这样的帖子,但在Swift上没有真正的帖子.当你长按按钮本身时,这就是项目获取按钮描述的全部内容.如果有人有任何想法如何用我到目前为止所做的完成,或者有不同的方法,请告诉我.
谢谢!
以上是大佬教程为你收集整理的ios – UITapGestureRecognizer发送者是手势,而不是ui对象全部内容,希望文章能够帮你解决ios – UITapGestureRecognizer发送者是手势,而不是ui对象所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。