1. <legend id='K8y1s'><style id='K8y1s'><dir id='K8y1s'><q id='K8y1s'></q></dir></style></legend><tfoot id='K8y1s'></tfoot>

    <small id='K8y1s'></small><noframes id='K8y1s'>

      <bdo id='K8y1s'></bdo><ul id='K8y1s'></ul>
    1. <i id='K8y1s'><tr id='K8y1s'><dt id='K8y1s'><q id='K8y1s'><span id='K8y1s'><b id='K8y1s'><form id='K8y1s'><ins id='K8y1s'></ins><ul id='K8y1s'></ul><sub id='K8y1s'></sub></form><legend id='K8y1s'></legend><bdo id='K8y1s'><pre id='K8y1s'><center id='K8y1s'></center></pre></bdo></b><th id='K8y1s'></th></span></q></dt></tr></i><div id='K8y1s'><tfoot id='K8y1s'></tfoot><dl id='K8y1s'><fieldset id='K8y1s'></fieldset></dl></div>
    2. iOS11 没有正确接受约束

      时间:2023-09-10
        <bdo id='QgO1p'></bdo><ul id='QgO1p'></ul>

              <tfoot id='QgO1p'></tfoot>

              <small id='QgO1p'></small><noframes id='QgO1p'>

              <legend id='QgO1p'><style id='QgO1p'><dir id='QgO1p'><q id='QgO1p'></q></dir></style></legend>

                <tbody id='QgO1p'></tbody>
            1. <i id='QgO1p'><tr id='QgO1p'><dt id='QgO1p'><q id='QgO1p'><span id='QgO1p'><b id='QgO1p'><form id='QgO1p'><ins id='QgO1p'></ins><ul id='QgO1p'></ul><sub id='QgO1p'></sub></form><legend id='QgO1p'></legend><bdo id='QgO1p'><pre id='QgO1p'><center id='QgO1p'></center></pre></bdo></b><th id='QgO1p'></th></span></q></dt></tr></i><div id='QgO1p'><tfoot id='QgO1p'></tfoot><dl id='QgO1p'><fieldset id='QgO1p'></fieldset></dl></div>

                本文介绍了iOS11 没有正确接受约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在商店里有一个应用程序,为了支持所有设备和键盘,我正在根据键盘高度更改底部约束高度.它适用于除 iOS11 之外的所有 iOS 版本.该按钮没有改变它的位置,如下图所示.

                I have an app on the store, in order to support all devices and keyboard I am changing the bottom constraint height according to keyboard height. It is working on all iOS versions except on iOS11. The button is not changing its place as it is shown in the below pictures.

                谢谢!

                这是 iOS10 预览版

                this is iOS10 preview

                这是 iOS11 预览版

                this is iOS11 preview

                代码

                    func keyboardWillShow(notification: NSNotification) {
                    if !keyboardIsHidden{
                        return;
                    }
                    if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue {
                        keyboardIsHidden = false
                        nextButtonBottmConstraint.constant = nextButtonBottmConstraint.constant + keyboardSize.height
                    }
                }
                

                推荐答案

                如果您使用 UIKeyboardWillShowNotification 来获取键盘高度,然后将 UIKeyboardFrameBeginUserInfoKey 更改为 UIKeyboardFrameEndUserInfoKey

                If you are using UIKeyboardWillShowNotification to get the keyboard height then change UIKeyboardFrameBeginUserInfoKey with UIKeyboardFrameEndUserInfoKey

                UIKeyboardFrameBeginUserInfoKey 为键盘矩形高度返回 0iOS 11 中的值.将其更改为 UIKeyboardFrameEndUserInfoKey 可能解决这个问题.

                UIKeyboardFrameBeginUserInfoKey returns 0 for keyboard rect height value in iOS 11. Changing it to UIKeyboardFrameEndUserInfoKey might solve this issue.

                Objective-C

                - (void)keyboardWasShown:(NSNotification*)aNotification {
                    NSDictionary* info = [aNotification userInfo];
                    CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
                    //Change constraints
                }
                

                斯威夫特 3

                func keyboardWasShown(_ aNotification: Notification) {
                    let info = aNotification.userInfo
                    let kbSize: CGSize? = info?[UIKeyboardFrameEndUserInfoKey]?.cgRectValue?.size
                    //Change constraints
                }
                

                这篇关于iOS11 没有正确接受约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  <tbody id='EyXFS'></tbody>
                    <bdo id='EyXFS'></bdo><ul id='EyXFS'></ul>
                  • <i id='EyXFS'><tr id='EyXFS'><dt id='EyXFS'><q id='EyXFS'><span id='EyXFS'><b id='EyXFS'><form id='EyXFS'><ins id='EyXFS'></ins><ul id='EyXFS'></ul><sub id='EyXFS'></sub></form><legend id='EyXFS'></legend><bdo id='EyXFS'><pre id='EyXFS'><center id='EyXFS'></center></pre></bdo></b><th id='EyXFS'></th></span></q></dt></tr></i><div id='EyXFS'><tfoot id='EyXFS'></tfoot><dl id='EyXFS'><fieldset id='EyXFS'></fieldset></dl></div>

                        <tfoot id='EyXFS'></tfoot>

                        <legend id='EyXFS'><style id='EyXFS'><dir id='EyXFS'><q id='EyXFS'></q></dir></style></legend>

                      1. <small id='EyXFS'></small><noframes id='EyXFS'>