<bdo id='M6dyd'></bdo><ul id='M6dyd'></ul>

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

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

        <legend id='M6dyd'><style id='M6dyd'><dir id='M6dyd'><q id='M6dyd'></q></dir></style></legend>
      2. <tfoot id='M6dyd'></tfoot>
      3. 以编程方式禁用 UIButton

        Disable UIButton programmatically(以编程方式禁用 UIButton)
          <tbody id='VWSBo'></tbody>

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

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

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

                <tfoot id='VWSBo'></tfoot>
                1. 本文介绍了以编程方式禁用 UIButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我很困惑为什么这段代码不起作用.我有一个登录按钮,我想在用户未登录时禁用它.

                  I'm stumped at why this code isn't working. I have a login button that I want to disable when the user isn't logged in.

                  我的 .h 文件中有一个 UIButton,如下所示:

                  I have a UIButton delared in my .h file like so:

                     IBOutlet UIButton *myBtn;
                  

                  我已经在 Interface Builder 中为这个按钮设置了一个引用出口.

                  I've set up a referencing outlet in Interface Builder to this button.

                  在我的 .m 文件中,我尝试过:

                  In my .m file, I've tried:

                  [myBtn setEnabled: NO];
                  

                  myBtn.enabled = NO;
                  

                  但是这些都没有禁用我所在的条件语句中的按钮.(我想在用户成功登录时禁用登录按钮)

                  But neither of these disable the button in the conditional statement I'm in. (I want to disable the login button when the user successfully logs in)

                  我可以在同一屏幕上使用另外两个按钮来执行此操作,所以我知道代码是正确的.我没有抛出任何错误,所以我认为该对象存在.在 XCode 中对 myBtn 的引用也会改变颜色,因此它似乎是一个有效的引用.

                  I'm able to do this with two other buttons on the same screen, so I know the code is correct. I don't throw any errors, so I think the object exists. The references to myBtn change color in XCode, too, so it appears to be a valid reference.

                  我一定错过了什么.我在这里做错了什么?(我是一名 Windows 开发人员,在 Objective-C 方面相对较新)

                  I must be missing something. What am I doing wrong here? (I'm a Windows developer, relatively new at Objective-C)

                  推荐答案

                  我觉得没问题.您在合成按钮吗?试试

                  It seems ok to me. Are you synthesizing the button? Try

                  self.myBtn.enabled = NO;
                  

                  这篇关于以编程方式禁用 UIButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UIButton title text color(UIButton 标题文本颜色)
                  Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                  Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                  How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                  iPhone UIButton - image position(iPhone UIButton - 图像位置)
                  UIButton remove all target-actions(UIButton 删除所有目标动作)
                  <legend id='b2NL5'><style id='b2NL5'><dir id='b2NL5'><q id='b2NL5'></q></dir></style></legend>
                    <tbody id='b2NL5'></tbody>

                        <bdo id='b2NL5'></bdo><ul id='b2NL5'></ul>

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

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