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

顯示 iphone 的鍵盤時調(diào)整 UIView 的大小,如何?

resize UIView when showing the keyboard for iphone, how to?(顯示 iphone 的鍵盤時調(diào)整 UIView 的大小,如何?)
本文介紹了顯示 iphone 的鍵盤時調(diào)整 UIView 的大小,如何?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我將向您展示一個眾所周知的 whatsapp 示例當(dāng)您觸摸文本內(nèi)部時,鍵盤會彈出,因此我必須向上移動或移動所有條并將視圖大小調(diào)整為一半,這樣我仍然可以看到我正在輸入的文本和發(fā)送按鈕

I will show you an example with the well known whatsapp When you touch inside the text the keyboard pops up , so I have to move or shift all that bar up and resize the view to half, so I can still see the text that I'm typing and the send button

第一階段:http://www.appbank.net/wp-content/uploads/2010/10/WhatsAppMessenger-18.jpg

第二階段:http://www.onetooneglobal.com/wp-content/uploads/2011/02/onetoone_whatsapp_2.png

實現(xiàn)這一目標的最佳方法是什么?

What would be the best way to achieve this?

推薦答案



#define kOFFSET_FOR_KEYBOARD 280.0

- (void)keyboardWillHide:(NSNotification *)notif {
    [self setViewMoveUp:NO];
}


- (void)keyboardWillShow:(NSNotification *)notif{
    [self setViewMoveUp:YES];
}


- (void)textFieldDidBeginEditing:(UITextField *)textField {
    stayup = YES;
    [self setViewMoveUp:YES];
}


- (void)textFieldDidEndEditing:(UITextField *)textField {
    stayup = NO;
    [self setViewMoveUp:NO];
}

//method to move the view up/down whenever the keyboard is shown/dismissed
-(void)setViewMoveUp:(BOOL)moveUp
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3]; // if you want to slide up the view
    [UIView setAnimationBeginsFromCurrentState:YES];

    CGRect rect = self.view.frame;
    if (moveUp)
    {
        // 1. move the view's origin up so that the text field that will be hidden come above the keyboard 
        // 2. increase the size of the view so that the area behind the keyboard is covered up.

        if (rect.origin.y == 0 ) {
            rect.origin.y -= kOFFSET_FOR_KEYBOARD;
            //rect.size.height += kOFFSET_FOR_KEYBOARD;
        }

    }
    else
    {
        if (stayup == NO) {
            rect.origin.y += kOFFSET_FOR_KEYBOARD;
            //rect.size.height -= kOFFSET_FOR_KEYBOARD;
        }
    }
    self.view.frame = rect; 
    [UIView commitAnimations];
}

試試這個方法.根據(jù)您的要求對其進行編輯.

Try this methods. Edit it according to your requirement.

這篇關(guān)于顯示 iphone 的鍵盤時調(diào)整 UIView 的大小,如何?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Find the CGPoint on a UIView rectangle intersected by a straight line at a given angle from the center point(在與中心點成給定角度的直線相交的 UIView 矩形上找到 CGPoint)
Is it possible to reference a variable with a string and an int?(是否可以使用字符串和 int 引用變量?)
Is there a native YAML library for iPhone?(是否有適用于 iPhone 的本機 YAML 庫?)
View aligned to top of keyboard appears in wrong place in iOS 9 Shortcut Bar only mode(在 iOS 9 Shortcut Bar only 模式下,與鍵盤頂部對齊的視圖出現(xiàn)在錯誤的位置)
Disable speech to text button (Micro phone) on soft input keyboard in android programmatically(以編程方式在android中的軟輸入鍵盤上禁用語音到文本按鈕(麥克風(fēng)))
UIkeyboard type(UI鍵盤類型)
主站蜘蛛池模板: 亚洲欧美综合 | 成人在线免费视频观看 | 国产裸体永久免费视频网站 | 97精品超碰一区二区三区 | 日韩av资源 | 波多野结衣在线观看一区二区 | 国产精品一二三四区 | 国产激情一区二区三区 | 国产成人精品一区二区 | 成人做爰69片免费 | 久久av资源 | 天天躁狠狠躁 | 国产一区欧美 | 亚洲天堂视频在线观看 | 91精品一区二区 | 亚洲日本在线观看 | 激情综合网五月 | 国产又黄又爽视频 | 午夜美女福利视频 | 久久精品一区二区 | 日韩精品网站 | 国产免费成人 | 免费网站www | 婷婷第四色 | 精品国产乱码久久久久久蜜柚 | 亚洲精品在线观看视频 | 日韩精品久久久久久久酒店 | 人人爱人人 | 日韩专区中文字幕 | 亚洲在线播放 | 国产日韩中文字幕 | 诱人的大乳奶3做爰 | 国产又黄又猛 | 97精品在线观看 | 免费观看a级片 | 成人午夜又粗又硬又大 | 国产福利视频 | 深夜福利视频在线观看 | 日韩欧美精品一区二区 | 91亚洲国产成人精品性色 | 日本黄色录像 |