小编Tre*_*ree的帖子

iOS8 UIKeyboardWillShowNotification第三方键盘高度

当显示键盘时,我有一个需要调整位置的UI.

以下用于检测键盘何时显示:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(keyboardWillShow:)
                                             name:UIKeyboardWillShowNotification
                                           object:nil];
Run Code Online (Sandbox Code Playgroud)

注意:我尝试过UIKeyboardWillShowNotification和UIKeyboardDidShowNotification

- (void)keyboardWillShow:(NSNotification *)n {
    if (isKeyboardShowing)
    return;

NSDictionary* userInfo = [n userInfo];

// get the size of the keyboard
CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;


// Animate keyboard shift
[self.view layoutIfNeeded];

[UIView animateWithDuration:0.2f animations:^{
    // some animation here
} completion:^(BOOL finished) {
    if (finished)
        isKeyboardShowing = YES;
}];
Run Code Online (Sandbox Code Playgroud)

对于自定义键盘,键盘大小返回{320,0}.由于键盘现在可以具有不同的高度,因此在呈现键盘时我无法使用静态值来更改UI.

这是ios8的问题吗?有没有其他方法动态获取键盘高度?

编辑:这是userInfo Dict:

{name = UIKeyboardDidShowNotification; userInfo = {
    UIKeyboardAnimationCurveUserInfoKey = 7;
    UIKeyboardAnimationDurationUserInfoKey = "0.25";
    UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 0}}"; …
Run Code Online (Sandbox Code Playgroud)

keyboard objective-c ios xcode6 ios8

7
推荐指数
1
解决办法
7054
查看次数

UITabBarController隐藏更多导航栏

当有5个或更多viewcontrollersUITabBarController,默认情况下,更多的选项将可用.

当您选择"更多"时viewcontrollers,viewcontroller会显示导航栏和后退按钮.

有没有办法隐藏这个导航栏?

objective-c uitabbarcontroller uinavigationcontroller ios

4
推荐指数
1
解决办法
1780
查看次数