我有一个实现 touchesEnded 方法的自定义 UIScrollView 类。我的项目有一个故事板,我试图在视图控制器上调用 performSeguewithIdentifier,但是当我调用该方法时changePhoto
,它给了我下面的错误。我已验证我的 segue 标记正确,没有拼写错误。看起来当我创建 PhotoViewController 的新实例时,它不会创建任何情节提要和/或 segues。我该怎么做才能让 segue 从我的 UIScrollView 正常工作?
自定义UIScrollView.m
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
if ([[touch view] isKindOfClass:[UIImageView class]]) {
UIView *imageView = [touch view];
NSInteger tag = imageView.tag;
NSLog(@"Tag: %d", tag);
PhotoViewController *vc = [[PhotoViewController alloc]init];
[vc changePhoto:1];
}
}
PhotoViewController.m
-(void)changePhoto:(int)spaceId {
[self performSegueWithIdentifier: @"photoSegue" sender: self];
}
错误:
2012-10-09 10:28:38.765 Spaces[82945:11303] *由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“接收者()没有标识符为“photoSegue”的segue”