久久久久久久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 初始化程序?)
主站蜘蛛池模板: 国产精品免费福利 | 亚洲精品一区二区在线 | 激情黄色在线观看 | 亚洲国产成人精 | 精精国产xxxx视频在线播放 | 午夜精品久久久 | 成人在线看片 | 久久草在线视频 | 欧美日韩视频一区二区 | 成人在线一区二区三区 | 91久久视频 | 国产精品视频一二三区 | 一区二区国产精品 | av成年人网站| 免费成人高清 | 国产免费一区 | 一区二区三区韩国 | 国产欧美久久精品 | 久久久精品影院 | 国产一区影院 | 国产区视频在线观看 | 天堂色 | 最新免费黄色网址 | 精品久久久久久久久久 | 一级做a爰片性色毛片16 | 蜜桃在线一区二区三区 | 在线一区| 欧美激情精品久久久久久 | 国产三级精品三级在线观看四季网 | 毛片在线免费 | 91麻豆精品国产91久久久久久 | 99热国产在线播放 | 午夜视频网 | 国产一区精品 | 久久久久久久久久久91 | 中文字幕视频在线看 | 日韩在线视频一区 | 日韩欧美亚洲综合 | 一区二区在线 | 日日夜夜天天 | av男人的天堂av |