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

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

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

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

    1. 按下时切换 UIButton 状态,如开关

      toggle UIButton-state when pressing, like a switch(按下时切换 UIButton 状态,如开关)
      1. <tfoot id='0TYxh'></tfoot>
        • <i id='0TYxh'><tr id='0TYxh'><dt id='0TYxh'><q id='0TYxh'><span id='0TYxh'><b id='0TYxh'><form id='0TYxh'><ins id='0TYxh'></ins><ul id='0TYxh'></ul><sub id='0TYxh'></sub></form><legend id='0TYxh'></legend><bdo id='0TYxh'><pre id='0TYxh'><center id='0TYxh'></center></pre></bdo></b><th id='0TYxh'></th></span></q></dt></tr></i><div id='0TYxh'><tfoot id='0TYxh'></tfoot><dl id='0TYxh'><fieldset id='0TYxh'></fieldset></dl></div>

          <small id='0TYxh'></small><noframes id='0TYxh'>

          <legend id='0TYxh'><style id='0TYxh'><dir id='0TYxh'><q id='0TYxh'></q></dir></style></legend>

            • <bdo id='0TYxh'></bdo><ul id='0TYxh'></ul>

                  <tbody id='0TYxh'></tbody>
                本文介绍了按下时切换 UIButton 状态,如开关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                -(void)setState:(id)sender
                {
                    UIButton* button = (UIButton*)sender;
                    BOOL buttonBool = ([button state]==selected : YES ? NO);
                    [sender setSelected:buttonBool++];
                
                }
                

                这是我的想法,但我无法弄清楚调用功能的按钮的实际状态.任何调用此功能的按钮都应在默认状态和选定状态之间切换,以便它像开关一样工作.我只需要拥有自己的背景图形,否则我使用了开关.

                this is my idea, but i cant figure out the actual state of the button calling the funktion. any button, that calls this funktion, should be toggled between default and selected-state, so that it works like a switch. i just need to have own background-graphics, else i had used a switch.

                那么,谁能纠正我的想法?

                so, can anyone please correct my idea ?

                推荐答案

                试试这个方法:

                -(void)setState:(id)sender
                {
                    UIButton* button = (UIButton*)sender;
                    button.selected = !button.selected;
                }
                

                这篇关于按下时切换 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 标题颜色?)
                Minimum sensible button size on iPhone(iPhone 上的最小合理按钮大小)
                iPhone UIButton - image position(iPhone UIButton - 图像位置)
                <legend id='RNdkM'><style id='RNdkM'><dir id='RNdkM'><q id='RNdkM'></q></dir></style></legend>
                <i id='RNdkM'><tr id='RNdkM'><dt id='RNdkM'><q id='RNdkM'><span id='RNdkM'><b id='RNdkM'><form id='RNdkM'><ins id='RNdkM'></ins><ul id='RNdkM'></ul><sub id='RNdkM'></sub></form><legend id='RNdkM'></legend><bdo id='RNdkM'><pre id='RNdkM'><center id='RNdkM'></center></pre></bdo></b><th id='RNdkM'></th></span></q></dt></tr></i><div id='RNdkM'><tfoot id='RNdkM'></tfoot><dl id='RNdkM'><fieldset id='RNdkM'></fieldset></dl></div>

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

                  <tbody id='RNdkM'></tbody>
                <tfoot id='RNdkM'></tfoot>
                • <bdo id='RNdkM'></bdo><ul id='RNdkM'></ul>