我正在使用自己的图像创建一个自定义按钮,并将其分配给我拥有的导航控制器的 rightbarbutton。问题是当用户单击按钮时,我得到一个关于我的控制器无法识别该选择器的异常信息?
UIImage* image1 = [UIImage imageNamed:@"someImage.png"];
CGRect imgRect = CGRectMake(0, 0, image1.size.width/1.8, image1.size.height/1.8);
UIButton *myButton = [[UIButton alloc] initWithFrame:imgRect];
[myButton setBackgroundImage:image1 forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(nextScreenButtonAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *barButton =[[UIBarButtonItem alloc] initWithCustomView:myButton];
[self.navigationItem setRightBarButtonItem:myButton];
self.navigationController.navigationBarHidden = false;