本文介绍了按钮动作没有响应iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我按下 nextButton 时,也就是 UIBarButton.然后不执行相关操作.
When I press the nextButton, which is UIBarButton. Then associated action is not performed.
UIButton *nextButton1=[UIButton buttonWithType:UIButtonTypeCustom];
[nextButton1 setBackgroundImage:[UIImage imageNamed:@"next.png"] forState:UIControlStateNormal];
[nextButton1 addTarget:self action:@selector(goToItems) forControlEvents:UIControlEventTouchUpOutside];
[nextButton1 sizeToFit];
UIBarButtonItem *nextButton=[[UIBarButtonItem alloc]initWithCustomView:nextButton1];
self.navigationItem.rightBarButtonItem=nextButton;
推荐答案
[nextButton1 addTarget:self action:@selector(goToItems) forControlEvents:UIControlEventTouchUpInside];
你正在传递UIControlEventTouchUpOutside
,应该是UIControlEventTouchUpInside
这篇关于按钮动作没有响应iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!