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

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

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

          <bdo id='cAB21'></bdo><ul id='cAB21'></ul>
      2. UITableViewCell 中的 UIButton

        时间:2023-07-08
        • <tfoot id='l5vlv'></tfoot>
            <tbody id='l5vlv'></tbody>

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

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

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

                  问题描述

                  我在 UITableViewCell 中有一个带有图像的 UIButton.当单元格被突出显示时,按钮也进入突出显示状态(即图像的较暗阴影),无论用户是否在按钮的范围内单击.

                  I have a UIButton with an image inside of a UITableViewCell. When the cell is being highlight, the button is also entering the highlighted state (i.e. a darker shade of the image), regardless of whether the user is clicking within the bounds of the button or not.

                  我不想要此功能 - 我只希望在单击按钮时突出显示该按钮,而不是在单击整个单元格时突出显示.

                  I don't want this functionality - I only want the button to be highlighted when the button is clicked, not when the entire cell is being clicked.

                  我尝试将处于突出显示状态的图像设置为与普通图像相同.这解决了这个问题,但它会阻止按钮在真正突出显示时改变颜色.

                  I've tried to set the image in the highlighted state to be the same as the normal image. This fixes the issue however it stops the button from changing color when it really is highlighted.

                  有什么想法可以达到预期的效果吗?

                  Any ideas how to achieve the desired effect?

                  推荐答案

                  这把我逼疯了.我发现您需要覆盖 setHighlighted:animated:setSelected:animated:

                  This was driving me crazy. I figured out that you need to override setHighlighted:animated: and setSelected:animated:

                  - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
                      [super setHighlighted:highlighted animated:animated];
                      self.yourButton.highlighted = NO;
                  }
                  
                  - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
                      [super setSelected:selected animated:animated];
                      self.yourButton.selected = NO;
                      // If you don't set highlighted to NO in this method,
                      // for some reason it'll be highlighed while the 
                      // table cell selection animates out
                      self.yourButton.highlighted = NO;
                  }
                  

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

                  上一篇:在情节提要中更改 UIButton BorderColor 下一篇:如何在 UIImage 上像 UIButton 一样在点击时实现突出显示?

                  相关文章

                  • <bdo id='goHQs'></bdo><ul id='goHQs'></ul>

                  <tfoot id='goHQs'></tfoot>

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

                  2. <small id='goHQs'></small><noframes id='goHQs'>

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