简体   繁体   中英

Show/Hide UINavigationBar with animated screen move like in 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?

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM