显示/隐藏 UINavigationBar,并像 UISearchBar 一样使用动画屏幕移动
我在屏幕上有 UITextView,在其顶部有 UINavigationBar。 我怎样才能达到像触摸 UISearchBar 时的效果。是否可以?
I have UITextView on the sreen and UINavigationBar on top of it.
How can i achieve effect like when in touching UISearchBar. Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几乎在里面有一个
UISearchBar
-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
您可以使用[navigationController setNavigationBarHidden: YESanimated:YES]
使其动画隐藏您单击搜索栏内部,然后单击- 内部(void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
您可以使用[navigationController setNavigationBarHidden: NOanimated:YES]
使其以动画方式返回到视图中。在
UITextView
的 Delegate 中,您将获得两个本质上相同的方法。- (void)textViewDidBeginEditing:(UITextView *)textView
您放置的位置
[navigationController setNavigationBarHidden: YESanimated:YES]
- (void)textViewDidEndEditing:(UITextView *)textView
您放置的位置
[navigationController setNavigationBarHidden:无动画:是]
Pretty much with a
UISearchBar
inside of-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
you'd use[navigationController setNavigationBarHidden: YES animated:YES]
which animates it to hide when you click inside of the search bar, then inside of- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
you'd use[navigationController setNavigationBarHidden: NO animated:YES]
which animates it returning into the view.In the
UITextView
's Delegate you get two methods that are essentially the same.- (void)textViewDidBeginEditing:(UITextView *)textView
Where you would put
[navigationController setNavigationBarHidden: YES animated:YES]
- (void)textViewDidEndEditing:(UITextView *)textView
Where you would put
[navigationController setNavigationBarHidden: NO animated:YES]