iphone - 按钮操作没有响应 iphone

标签 iphone ios uibutton uibarbuttonitem

当我按下 nextButton 时,它是 UIBarButton。然后不执行相关操作。

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 - 按钮操作没有响应 iphone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11360548/

相关文章:

php - 从移动设备上传图像文件

iphone - Cocos2d。一个带有粒子的 CCLayer 实例适用于很多场景?

ios - 如何快速使用来自 reverseGeocodeLocation 的数据?

objective-c - 正确地将我的按钮链接到我的 View (在 UINavigationController 中)?

ios - 从另一个 Controller 的 UIPickerView 更新 UIButton 的标题

ios - 信息按钮推到UIViewController

iphone - Three20 TLauncher 问题

iphone - 使用 CoreAnimation 或 OpenGL 弯曲/扭曲 View 以实现轮播效果

ios - 如何在模拟器中重置钥匙串(keychain)?

ios - SWRevealViewController:当 self.revealViewController().revealToggleAnimated(true) 时 frontViewController 上的回调是什么