我有以下内容:
-(void)turnBlue:(DetailVC *) controller {
self.Label.text = controller.selected.name;
self.selected = controller.selected;
[controller.navigationController popViewControllerAnimated:YES];
}
我正试图从我的ibaction进入:
- (IBAction)pressButton:(id)sender {
//filler code here
}
我正在尝试
[self turnBlue:selected];
但是我得到'不兼容的指针类型发送......'
我试过控制器,我错过了哪些细节?
答案 0 :(得分:0)
应该是这样的:
// Allocate or get already created instance of `DetailVC`
DetailVC *controller = [[DetailVC alloc] initWithNibName..........];
// Pass instance to `turnBlue` function:
[self turnBlue:controller];
turnBlue
只能接受DetailVC
类型的参数,而您传递的selected
似乎不属于DetailVC
类型,因此您收到无法指针类型错误
希望它有所帮助!