我有两个UIViewController。在view1中,我使用PIN管理注释,所以我需要在用户点击附件控件时准确推送view2,我的代码是这样的:
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
NSLog(@"calloutAccessoryControlTapped");
[self performSegueWithIdentifer:@"My identifier" sender:self];
}
编译时,我收到了这个警告:
Instance method '-performSegueWithIdentifer:sender:' not found (return type defaults to 'id')
运行时,应用程序显然会崩溃:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[view1 performSegueWithIdentifer:sender:]: unrecognized selector sent to instance 0x7d94ca0'
在故事板中,我选择了view1,ctrl+left click+ drop
到view2,然后我选择了push
。此外,我已将segue标识符设置为My identifier
。那么我在这里缺少什么?
答案 0 :(得分:4)
“performSegueWithIdentifer”有拼写错误。有一封字母'我'缺失了。尝试“performSegueWithIdentifier”。