我有一个基于tabBar控制器的应用程序。在某个视图中,我想添加滑动手势识别并将当前视图与另一个视图(不是tabBarController数组的一部分)交换。我曾尝试过:交换tabview控制器内的视图
- (IBAction)swipeLeftDetected:(UIGestureRecognizer *)sender
{
//Does not work
UIViewController *DesiredViewController =[[UIViewController alloc] initWithNibName:@"DesiredViewController" bundle:nil];
DesiredViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:DesiredViewController animated:YES];
[self.view addSubview:DesiredViewController.view];
}
但程序崩溃。我得到的错误与SegmentedControl有关,它出现在下一个视图中,但在当前视图中不存在。意见独立完美!
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:'[<UIViewController 0xa355fb0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key X_SegmentedControl.'
我不明白我在做什么错误..我想完全交换视图,而不是把一个放在另一个之上。有什么建议吗?谢谢
http://stackoverflow.com/questions/16406892/nsunkownexception-this-class-is-not-key-value-coding-compliant-for-the-key-pie/16407010#16407010 – Peteee24 2013-05-10 08:45:58