Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ipad 未显示uisearchbar的键盘_Ipad_Ios_Keyboard_Uisearchbar - Fatal编程技术网

Ipad 未显示uisearchbar的键盘

Ipad 未显示uisearchbar的键盘,ipad,ios,keyboard,uisearchbar,Ipad,Ios,Keyboard,Uisearchbar,我有一个ui搜索栏,即使它是第一个响应程序,键盘也不会显示。我可以使用笔记本电脑的键盘开始在搜索栏中输入,我可以看到我在搜索栏中输入的内容,但模拟器和实际iPad上的键盘不会出现。它在iOS 3.2下运行良好,但在今天早上升级到iOS 4.2后停止工作。 以下是相关代码: //触摸时将触发包含搜索栏的搜索视图的文本字段 -(无效)textFieldDidBeginEditing:(UITextField*)textField{ [textField resignFirstResponder];

我有一个
ui搜索栏
,即使它是第一个响应程序,键盘也不会显示。我可以使用笔记本电脑的键盘开始在搜索栏中输入,我可以看到我在搜索栏中输入的内容,但模拟器和实际iPad上的键盘不会出现。它在iOS 3.2下运行良好,但在今天早上升级到iOS 4.2后停止工作。 以下是相关代码:

//触摸时将触发包含搜索栏的搜索视图的文本字段 -(无效)textFieldDidBeginEditing:(UITextField*)textField{ [textField resignFirstResponder]; UIViewController*detailViewController=nil; 实现的SearchViewController*searchController= [[ImplementedSearchViewController alloc]initWithNibName:@“ImplementedSearchView”捆绑包:nil]; ... detailViewController=searchController; MyAppDelegate*委托=[[UIApplication sharedApplication]委托]; UINavigationController*导航=(UINavigationController*) [delegate.splitViewController.ViewController对象索引:0]; NSArray*viewControllers=[NSArray arrayWithObjects:nav, 详细视图控制器,无]; self.splitViewController.viewControllers=viewControllers; HomeViewController*hHomeController=[nav.ViewController对象索引:0]; //如果有爆米花,就把它扔掉。 如果(homeController.popoverController!=nil){ [homeController.popoverController解除PopOveranimated:是]; } //配置新视图控制器的弹出按钮 (显示视图并创建其工具栏/导航栏后)。 如果(homeController.RootPopoOverButtonim!=nil){ [detailViewController] showRootPopoOverButtonim:homeController.RootPopoOverButtonim]; } [详细视图控制器发布]; }

// Inside the viewDidLoad of the search view - (void)viewDidLoad { self.table.frame = CGRectMake(table.frame.origin.x, table.frame.origin.y, table.frame.size.width, 680); self.table.backgroundColor = [UIColor colorWithRed:239/255.0 green:244/255.0 blue:255/255.0 alpha:1.0]; // searchBar is a UISearchBar [self.searchBar becomeFirstResponder]; } //在搜索视图的viewDidLoad中 -(无效)viewDidLoad{ self.table.frame=CGRectMake(table.frame.origin.x,table.frame.origin.y,table.frame.size.width,680); self.table.backgroundColor=[UIColor COLOR WITHRED:239/255.0绿色:244/255.0蓝色:255/255.0 alpha:1.0]; //searchBar是一个UISearchBar [self.searchBar成为第一响应者]; }
viewDidLoad
中的ui搜索栏不是
nil

有什么想法吗

谢谢,
Mihai

我在不同的地方使用相同的ui搜索栏。除了两种情况外,它在所有情况下都有效。我相信这个问题与文本字段没有辞去FirstResponder的职务有关(尽管我在该文本字段中调用了resignFirstResponder)。在其中一个地方,我也使用文本字段来触发搜索栏,但我使用的是选择器而不是文本字段委托方法(例如textFieldDidBeginEditing)。如果我从使用选择器切换到使用委托方法,它将停止工作,我也会遇到同样的问题(键盘没有出现)。我认为,对于这两种不起作用的情况,解决方案应该是从使用委托方法切换到使用选择器,但事实并非如此。我最后做的是从使用文本字段切换到使用按钮。在某种程度上,如果您不打算在文本字段中写入任何内容,那么使用文本字段没有任何意义(我只是用它来触发搜索栏)

我在不同的地方使用相同的ui搜索栏。除了两种情况外,它在所有情况下都有效。我相信这个问题与文本字段没有辞去FirstResponder的职务有关(尽管我在该文本字段中调用了resignFirstResponder)。在其中一个地方,我也使用文本字段来触发搜索栏,但我使用的是选择器而不是文本字段委托方法(例如textFieldDidBeginEditing)。如果我从使用选择器切换到使用委托方法,它将停止工作,我也会遇到同样的问题(键盘没有出现)。我认为,对于这两种不起作用的情况,解决方案应该是从使用委托方法切换到使用选择器,但事实并非如此。我最后做的是从使用文本字段切换到使用按钮。在某种程度上,如果您不打算在文本字段中写入任何内容,那么使用文本字段没有任何意义(我只是用它来触发搜索栏)

我可以证实,在iOS 4.3下,让第一响应者改用搜索栏解决了iPad上的问题。在我的例子中,我有一个UIViewController响应UIEvent。你必须在(!)之前明确地打电话给辞职的第一响应者 从视图层次结构中删除UIViewController以使其正常工作

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
    if (motion == UIEventSubtypeMotionShake){
    ...
    }
}

...

[someViewController becomeFirstResponder];

。。。(在我的例子中,我添加了一个层次结构,其中包括一个UIDABBARCONTROLLER,其中一个选项卡包含一个UINavigationController,它覆盖了窗口中的Searchcontroller)


没有线索,为什么这在iPhone上是不必要的。

我可以证实,在iOS 4.3下,在iPad上,放弃第一响应者而使用搜索栏解决了这个问题。在我的例子中,我有一个UIViewController响应UIEvent。你必须在(!)之前明确地打电话给辞职的第一响应者 从视图层次结构中删除UIViewController以使其正常工作

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
    if (motion == UIEventSubtypeMotionShake){
    ...
    }
}

...

[someViewController becomeFirstResponder];

。。。(在我的例子中,我添加了一个层次结构,其中包括一个UIDABBARCONTROLLER,其中一个选项卡包含一个UINavigationController,它覆盖了窗口中的Searchcontroller)


不知道为什么这在iPhone上是不必要的。

我正在显示textFieldDidBeginEditing:(UITextField*)textField委托方法上的搜索栏

键盘没有显示。所以对于第一个辞职的文本字段作为第一响应者。 i、 e

然后调用具有延迟的方法

[self performSelector:@selector(callSearchBar) withObject:NULL afterDelay:0.2];
在哪里

}


它可以工作

我在textfieldDiBeginEdit:(UITextField*)textField委托方法上显示搜索栏

    [self.searchDisplayController setActive: YES animated: YES]; 
    self.searchDisplayController.searchBar.hidden = NO;
    [self.searchDisplayController.searchBar becomeFirstResponder];
键盘没有显示。所以对于第一个辞职的文本字段作为第一响应者。 i、 e

然后调用具有延迟的方法

[self performSelector:@selector(callSearchBar) withObject:NULL afterDelay:0.2];
在哪里

}

[self performSelector:@selector(callSearchBar) withObject:NULL afterDelay:0.2];
-(void)callSearchBar{
[self.searchDisplayController setActive: YES animated: YES]; 
self.searchDisplayController.searchBar.hidden = NO;
[self.searchDisplayController.searchBar becomeFirstResponder];
    [self.searchDisplayController setActive: YES animated: YES]; 
    self.searchDisplayController.searchBar.hidden = NO;
    [self.searchDisplayController.searchBar becomeFirstResponder];