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

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

    <legend id='PQxss'><style id='PQxss'><dir id='PQxss'><q id='PQxss'></q></dir></style></legend>
  • <tfoot id='PQxss'></tfoot>

      1. 保持 iPhone UIButton 突出显示

        时间:2023-07-08

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

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

                1. <tfoot id='NKsz0'></tfoot>

                  本文介绍了保持 iPhone UIButton 突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有以下代码片段:

                  @interface Foo: UIViewController {
                    ...
                    UIButton *myButton;
                    ...
                  }
                  

                  @implementation Foo

                  @implementation Foo

                  - (void) viewDidLoad {
                    ...
                    myButton.highlighted = YES;
                    ...
                  }
                  

                  当我运行应用程序时,按钮以蓝色突出显示(默认行为).它按我的预期工作.

                  When I run the app, the button is highlighted in blue (default behavior). It works as I expected.

                  但是在按下按钮一次后,按钮不再突出显示.

                  But after pressing the button once, the button is no longer highlighted.

                  然后,我创建了一个 IBAction highlightButton 来处理 Touch Up Inside 事件,在该事件中我显式调用 myButton.highlighted = Yes;.不幸的是,按钮突出显示仍然没有保留.

                  Then, I created an IBAction highlightButton to handle Touch Up Inside event where I explicitly call myButton.highlighted = Yes;. Unfortunately, the button highlight still does not stay.

                  如何在按下后仍以蓝色突出显示?

                  How can I keep it highlighted in blue even after being pressed?

                  推荐答案

                  解决方法是在下一个runloop中做[button setHighlighted:YES]:

                  The solution is to do [button setHighlighted:YES] in the next runloop:

                  - (void)highlightButton:(UIButton *)b { 
                      [b setHighlighted:YES];
                  }
                  
                   - (IBAction)onTouchup:(UIButton *)sender {
                      [self performSelector:@selector(highlightButton:) withObject:sender afterDelay:0.0];
                  }
                  

                  这篇关于保持 iPhone UIButton 突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  1. <small id='6l7aI'></small><noframes id='6l7aI'>

                      <bdo id='6l7aI'></bdo><ul id='6l7aI'></ul>

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

                        1. <tfoot id='6l7aI'></tfoot><legend id='6l7aI'><style id='6l7aI'><dir id='6l7aI'><q id='6l7aI'></q></dir></style></legend>
                            <tbody id='6l7aI'></tbody>