IPHONE:ABPeoplePickerNavigationController隐藏导航栏 [英] IPHONE: ABPeoplePickerNavigationController hidden navigation bar

查看:122
本文介绍了IPHONE:ABPeoplePickerNavigationController隐藏导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有一个ABPeoplePickerNavigationController,在创建时将其
navigationBar设置为隐藏。

  peoplePickerController.navigationBar.hidden =是; 

这完美无缺,唯一的问题是当用户点击搜索框
时搜索一个人,当他从搜索返回时,导航栏被重新显示。
我怎样才能收到通知并再次隐藏导航栏?



我也认为这是一个苹果错误,因为在常规情况下搜索是,
导航栏被隐藏以获得更多空间,后来显示,但是
它没有考虑到这个栏可能首先隐藏在
中的事实。 / p>

欢迎任何技巧。

解决方案

最安全,最简单的方法是键盘隐藏/显示时跟踪。

   - (void)keyboardWillHide:(NSNotification *)通知
{
peoplePickerController.navigationBar.hidden = YES;
}

- (void)hideNavbarAndKeepHidden
{
peoplePickerController.navigationBar.hidden = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide :) name:UIKeyboardWillHideNotification object:nil];
}

- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}


Hello I have a ABPeoplePickerNavigationController, on creation is set its navigationBar hidden.

peoplePickerController.navigationBar.hidden = YES;

This works perfectly, the only problem is that when the user taps the search box to search for a person, as he return's from the search, the navigationBar is re-displayed,. How can I get notified of this and make the navigationBar hidden again ?

I also think this is an apple bug, since on regular cases when search is tapped, the navigation bar is hidden to make for more room, and later displayed, but it does not take into account the fact that the bar could have been hidden in the first place.

Any trick's welcomed.

解决方案

The safest and simplest method is to track when the keyboard hides/shows.

- (void)keyboardWillHide:(NSNotification *)notification
{
    peoplePickerController.navigationBar.hidden = YES;
}

- (void)hideNavbarAndKeepHidden
{        
    peoplePickerController.navigationBar.hidden = YES;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];   
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [super dealloc];
}

这篇关于IPHONE:ABPeoplePickerNavigationController隐藏导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆