[英]How to pop self view controller when I click the cancel button at the search bar?
I have created the search view controller to add the articles searched to the main view controller. 我已经创建了搜索视图控制器,以将搜索到的文章添加到主视图控制器中。 I wanna make it to pop itself from navigation view controller by clicking the cancel button of search bar.
我想通过单击搜索栏的“取消”按钮使其从导航视图控制器中弹出。 I have tried like as below:
我尝试如下所示:
- (void) searchBarCancelButtonClicked:(UISearchBar*) searchBar {
[self.navigationController popViewControllerAnimated:NO];
}
I need a help from everybody. 我需要大家的帮助。
检查是否已将searchBar委托分配给viewController ..,还检查navigationController是否为nil,则代码应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.