亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        如何完美適應(yīng)iOS中的鍵盤高度變化

        字號:


            #pragma mark - reg & unreg notification
            - (void)regNotification
            {
            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
            }
            - (void)unregNotification
            {
            [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillChangeFrameNotification object:nil];
            }
            #pragma mark - notification handler
            - (void)keyboardWillChangeFrame:(NSNotification *)notification
            {
            NSDictionary *info = [notification userInfo];
            CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
            CGRect beginKeyboardRect = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
            CGRect endKeyboardRect = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
            CGFloat yOffset = endKeyboardRect.origin.y - beginKeyboardRect.origin.y;
            CGRect inputFieldRect = self.inputTextField.frame;
            CGRect moreBtnRect = self.moreInputTypeBtn.frame;
            inputFieldRect.origin.y += yOffset;
            moreBtnRect.origin.y += yOffset;
            [UIView animateWithDuration:duration animations:^{
            self.inputTextField.frame = inputFieldRect;
            self.moreInputTypeBtn.frame = moreBtnRect;
            }];
            }
            通過獲取鍵盤消息的開始狀態(tài)、結(jié)束狀態(tài),以及變化周期,可以計算出具體的Y偏移,從而在相同時間里做相同偏移量。