0
沒有與此方法通uigesturerecognzer數據來父控制器
- (void)revealGesture:(UIPanGestureRecognizer *)recognizer{
}
,當我向它發送一個mesage弗羅馬孩子的ViewController使用輕掃其工作的主視圖控制器:
UIPanGestureRecognizer *navigationBarPanGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.navigationController.parentViewController action:@selector(revealGesture:)];
[self.navigationController.navigationBar addGestureRecognizer:navigationBarPanGestureRecognizer];
我想從子viewController內部傳遞消息,以便我可以首先做一些管家工作
UIPanGestureRecognizer *navigationBarPanGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(revealGesture:)];
[self.navigationController.navigationBar addGestureRecognizer:navigationBarPanGestureRecognizer];
和
- (void)revealGesture:(UIPanGestureRecognizer *)recognizer
{
[displaySearch resignFirstResponder];
RevealController *revealController = [self.navigationController.parentViewController isKindOfClass:[RevealController class]] ? (RevealController *)self.navigationController.parentViewController : nil;
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys: recognizer, @"recognizer", nil];
[revealController performSelector:@selector(revealGesture:) withObject:data];
}
是的,所有我想要做的是有一些代碼工作正常在繼續前取消鍵盤如果我只是針對「self.navigationController.parentViewController」直接
如何添加(UIPanGestureRecognizer *)識別器到NSDictionary?
與
-[__NSCFDictionary state]: unrecognized selector sent to instance 0x8619860
2013-05-02 21:12:05.752 PwC UK[57884:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary state]: unrecognized selector sent to instance 0x8619860'
編輯建議的解決方案我的代碼崩潰的工作,但鍵盤沒反應,到行恰克到
[self searchBarCancelButtonClicked:searchBar];
其中搜索欄是的UISearchBar
實例
非常明顯 - 出於某種原因,我認爲withObject必須是nsdictionary – JulianB 2013-05-02 20:59:01