我几个小时都在努力,没有任何效果.我试图在两个视图控制器之间进行切换,从一个tableViewController到另一个tableViewController.segue连接到顶层视图,而不是tableviewcell.在Xcode中设置的标识符与代码中使用的标识符相同(复制和粘贴).它昨晚工作正常,但现在我似乎无法在没有崩溃的情况下让它变得更好.
这里是调用segue的方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.photoList = [FlickrFetcher photosInPlace:[self.topPlacesList objectAtIndex:indexPath.row] maxResults:50];
NSLog(@"photolist %@", self.photoList);
NSLog(@"here");
[self performSegueWithIdentifier:@"segue1" sender:self];
NSLog(@"here");
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"segue1"])
{
PhotosTableViewController *photosTVC = segue.destinationViewController;
photosTVC.photoList = self.photoList;
}
}
Run Code Online (Sandbox Code Playgroud)
这是错误报告
2012-08-08 15:28:39.093热门地点[512:f803] *由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:'Receiver(PlacesTableViewController:0x6887ff0)没有带标识符'segue1'的segue''*第一次调用stack:(0x13c0052 0x1551d0a 0xde24b 0x3efd 0xa771d 0xa7952 0x92f86d 0x1394966 0x1394407 0x12f77c0 0x12f6db4 0x12f6ccb 0x12a9879 0x12a993e 0x17a9b 0x2778 0x26d5)终止调用抛出异常
这是故事板的截图http://s14.postimage.org/66wf13q4h/Screen_Shot_2012_08_08_at_3_22_10_PM.png
objective-c identifier uiviewcontroller segue uistoryboardsegue
我有问题,我一直坐着.我有一个UIViewController List
和一个UIViewController Login
.在Login
我有一个按钮"Done",同一个UIViewController上的另一个隐藏按钮有一个segue到List
(Type:push).我在xcode的接口构建器中为它命名了一个名为"LoginToList"的标识符.现在从另一个类(一个运行的类Login
是活动控制器)我调用:
[[Login sharedLogin] performSegueWithIdentifier:@"LoginToList"];
Run Code Online (Sandbox Code Playgroud)
所述Login
类显然有与标识符的SEGUE"LoginToList"
但我一直在:
'NSInvalidArgumentException', reason: 'Receiver (<Login: 0x6d79d90>) has no segue with identifier 'LoginToList''
Run Code Online (Sandbox Code Playgroud)
在+ (id) sharedLogin
看起来像这样:
+ (id) sharedLogin {
static Login *sharedLogin = nil;
@synchronized(self) {
if (sharedLogin == nil) {
sharedLogin = [[self alloc] init];
}
return sharedLogin;
}
}
Run Code Online (Sandbox Code Playgroud)
如果有人知道为什么会这么说,我会很高兴听到它!:D
我不知道我是否遗漏了一些愚蠢的东西,但我无法发现它:(
编辑:我已经在界面生成器中创建了一个segue(ctrl +点击拖动Login
到List
),使用UIViewControllers自己(Login
&List
).然后我命名了segue "LoginToList"
,换句话说我给了它标识符.我点击了segue,在右上角有一个我用过的"Identifier"字段.
我仍然得到错误说Login
没有带标识符的segue …