• <tfoot id='1VHfv'></tfoot>

        <bdo id='1VHfv'></bdo><ul id='1VHfv'></ul>

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

        <small id='1VHfv'></small><noframes id='1VHfv'>

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

        UIButton - 触摸更改图像

        UIButton - On touch change image(UIButton - 触摸更改图像)

          • <bdo id='6cHNw'></bdo><ul id='6cHNw'></ul>

          • <legend id='6cHNw'><style id='6cHNw'><dir id='6cHNw'><q id='6cHNw'></q></dir></style></legend>

            <small id='6cHNw'></small><noframes id='6cHNw'>

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

                  本文介绍了UIButton - 触摸更改图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我当时触摸按钮时,我想更改图像 &当我松开触摸按钮时,图像原样.

                  我想应用下面的代码,但这不是我的期望.

                  请给我任何建议.....

                   -(IBAction)actionEnter:(id)sender{if ([sender isSelected]) {[发件人 setImage:[UIImage imageNamed:@"enter-hover.png"]forState:UIControlStateNormal];[发件人设置选择:否];} 别的 {[发件人 setImage:[UIImage imageNamed:@"enter.png"]forState:UIControlStateSelected];[发件人 setSelected:YES];}

                  解决方案

                  您可以为此使用 UIControlStateHighlighted.

                  <上一页>[myButton setImage:[UIImage imageNamed:@"enter-hover.png"]forState:UIControlStateHighlighted];

                  您也可以从界面生成器中通过将图像设置为突出显示状态来进行设置.

                  When I touch the button at that time I want to change image & when i release the touch button image is as it is.

                  I want to apply below code but it's not with my expectation.

                  please give me any suggestion.....

                     -(IBAction)actionEnter:(id)sender{
                              if ([sender isSelected]) {
                                  [sender setImage:[UIImage imageNamed:@"enter-hover.png"] 
                                          forState:UIControlStateNormal];
                                  [sender setSelected:NO];
                              } else {
                                  [sender setImage:[UIImage imageNamed:@"enter.png"] 
                                          forState:UIControlStateSelected];
                                  [sender setSelected:YES];
                              }
                  

                  解决方案

                  You can use UIControlStateHighlighted for this.

                  [myButton setImage:[UIImage imageNamed:@"enter-hover.png"] 
                            forState:UIControlStateHighlighted];
                  

                  You can also set this from interface builder by setting the image for highlighted state.

                  这篇关于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 - 图像位置)
                1. <small id='vviG3'></small><noframes id='vviG3'>

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

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