【发布时间】:2018-03-14 03:44:17
【问题描述】:
我在选择器上声明了一个方法,并创建了一个同名的方法。然而,该方法说它无法识别。错误信息:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
UIImage *btnImage = [UIImage imageNamed:@"ic_favorite_border_48pt.png"];
UIButton *heart = [UIButton buttonWithType:UIButtonTypeCustom];
// get the image size and apply it to the button frame
CGRect listButtonFrame = heart.frame;
listButtonFrame.size = btnImage.size;
heart.frame = listButtonFrame;
[heart setImage:btnImage forState:UIControlStateNormal];
[heart addTarget:self.navigationController.parentViewController
action:@selector(revealToggle:)
forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *jobsButton =
[[UIBarButtonItem alloc] initWithCustomView:heart];
self.navigationItem.rightBarButtonItem = jobsButton;
-(void)revealToggle:(UIButton *)heart
{
}
【问题讨论】:
-
Objective-C 不支持嵌套方法。
标签: ios objective-c uibutton selector