久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何獲取鍵盤大小以調整 UITextView 的大小以及如

How to get keyboard size to resize UITextView and how to use UIKeyboardFrameEndUserInfoKey with Japanese keyboard?(如何獲取鍵盤大小以調整 UITextView 的大小以及如何將 UIKeyboardFrameEndUserInfoKey 與日文鍵盤一起使用
本文介紹了如何獲取鍵盤大小以調整 UITextView 的大小以及如何將 UIKeyboardFrameEndUserInfoKey 與日文鍵盤一起使用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如何獲取鍵盤大小以調整 UITextView 的大小以及如何將 UIKeyboardFrameEndUserInfoKey 與日文鍵盤一起使用?以下用于調整 UITextView 大小的代碼在標準鍵盤上運行良好.但不適用于日語.如何解決?

How to get a keyboard size to resize UITextView and how to use UIKeyboardFrameEndUserInfoKey with Japanese keyboard? The following code to resize UITextView works good on a standard keyboard. But doesn't work with Japanese. How to fix it?

- (void)keyboardWillShow:(NSNotification *)aNotification {
    [self moveTextViewForKeyboard:aNotification up:YES];
}

- (void)keyboardWillHide:(NSNotification *)aNotification {
    [self moveTextViewForKeyboard:aNotification up:NO]; 
}

- (void) moveTextViewForKeyboard:(NSNotification*)aNotification up: (BOOL) up
{
    NSDictionary* userInfo = [aNotification userInfo];

    // Get animation info from userInfo
    NSTimeInterval animationDuration;
    UIViewAnimationCurve animationCurve;

    CGRect keyboardEndFrame;

    [[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve];
    [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration];
    [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardEndFrame];

    // Animate up or down
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:animationDuration];
    [UIView setAnimationCurve:animationCurve];

    CGRect newFrame = textView.frame;
    CGRect keyboardFrame = [self.view convertRect:keyboardEndFrame toView:nil];

    newFrame.size.height -= keyboardFrame.size.height * (up? 1 : -1);
    textView.frame = newFrame;

    [UIView commitAnimations];
}

非常感謝您的幫助!

推薦答案

正確的代碼片段:

CGRect newFrame = editSource.frame;
CGRect keyboardFrame = [self.view convertRect:keyboardEndFrame toView:nil];
keyboardFrame.size.height -= tabBarController.tabBar.frame.size.height;
if (up) {
    editHeight = newFrame.size.height;
    newFrame.size.height -= keyboardFrame.size.height;
} else {
    newFrame.size.height = editHeight;
}
editSource.frame = newFrame;

警告!

該方法已過時.正確答案在這里:如何在 iOS 7 上通過 UITextView 添加對中文鍵盤的支持?

這篇關于如何獲取鍵盤大小以調整 UITextView 的大小以及如何將 UIKeyboardFrameEndUserInfoKey 與日文鍵盤一起使用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw stars using Quartz Core?(如何使用 Quartz Core 繪制星星?)
Why does giving addArcWithCenter a startAngle of 0 degrees make it start at 90 degrees?(為什么給 addArcWithCenter 一個 0 度的 startAngle 使它從 90 度開始?)
Find the CGPoint on a UIView rectangle intersected by a straight line at a given angle from the center point(在與中心點成給定角度的直線相交的 UIView 矩形上找到 CGPoint)
Which is the best way to estimate measure of photographed things?(哪種方法是估計拍攝物體尺寸的最佳方法?)
How to convert an Int to a Character in Swift(如何在 Swift 中將 Int 轉換為字符)
How to create a hex color string UIColor initializer in Swift?(如何在 Swift 中創建十六進制顏色字符串 UIColor 初始化程序?)
主站蜘蛛池模板: 国产成人久久av免费高清密臂 | 精品久久久久久亚洲精品 | 国产真实精品久久二三区 | 在线免费观看视频你懂的 | 国产精品免费一区二区三区 | 久久美女视频 | 亚洲日本乱码在线观看 | 日韩成人精品在线观看 | 国产亚洲欧美在线 | 久久久久久久久久久久91 | 天天射天天操天天干 | 一区二区三区四区在线视频 | 国产精品美女久久久久 | 国产一级淫片a直接免费看 免费a网站 | 超碰一区二区 | 99re | 91视频在线 | 免费黄色特级片 | 日韩毛片免费看 | 亚洲国产片 | 午夜a v电影 | 欧美黄色一区 | 国产日韩精品在线 | 亚洲一区二区三区四区五区午夜 | 国产欧美一区二区三区另类精品 | 免费在线观看成年人视频 | 一区二区三区在线免费观看 | 亚洲天堂中文字幕 | 国产婷婷综合 | 亚洲天堂一区 | 欧美精三区欧美精三区 | 日韩网站免费观看 | 九九热在线视频 | 国产激情偷乱视频一区二区三区 | 91精品久久久久久久久久 | 亚洲欧美激情精品一区二区 | 成人国产精品一级毛片视频毛片 | 中文字幕av网 | 精品国产区 | 中文字幕一区二区三区日韩精品 | 欧美成人一区二区三区 |