作者vincentno1 (Vincent)
看板MacDev
标题[问题] 请问Segue的使用 (BirdWatching)
时间Thu May 3 13:08:30 2012
不知道是否有人写过apple给的第二个练习 BirdWatching
我照着文件中的说明一步步练习 但最後一直有个bug我找不到
我试着要在master view的navigator bar右上方放一个按钮「+」
按了以後希望他跑到下一个view (addsigjting)
在storyboard中ctrl-drag建立了segue 命名为 ShowAddSightingView
然後在masterviewcontroller.m 中
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"ShowAddSightingView"]) {
AddSightingViewController *addController =
(AddSightingViewController *)
[[[segue destinationViewController] viewControllers] objectAtIndex:0];
addController.delegate = self;
}
}
但试跑时每次按下按钮都会跳出错误:
Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<AddSightingViewController 0x6d7e4a0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key cancel.'
不知道各位高手们是否有类似经验可以指点一下!
错误到底在哪阿!!!
万分感谢:)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.60.0.221
1F:→ wasihero:vc = segue.destinationViewController 就好了 05/05 04:35
2F:→ vincentno1:楼上大大是否可讲详细一点点 感谢! 05/06 00:02
3F:→ wasihero:你如果是要抓ViewController就我那行就好 05/06 01:12
4F:→ wasihero:如果是别的地方.就跟你标题上的问题无关.不关sqgue的事 05/06 01:13
5F:→ wasihero:发问题.自己的程式架构也不讲清楚.网友又不是神.. 05/06 01:15
6F:→ wasihero:谁会知道你storyboard里放了什麽元件什麽架构= =; 05/06 01:15
7F:→ wasihero:我只能猜你的AddSightingViewController里没有delegate 05/06 01:16
8F:推 DLMC:看起来是某个UI元件的IBOulet没拉好 05/31 18:17