<bdo id='7mweb'></bdo><ul id='7mweb'></ul>

    <tfoot id='7mweb'></tfoot>

    <small id='7mweb'></small><noframes id='7mweb'>

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

      动画 UIButton 状态变化

      时间:2023-07-08

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

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

                问题描述

                我正在使用带有图像的 UIButton 用于正常和突出显示状态.它们按预期工作,但我希望进行一些淡入淡出/合并过渡,而不仅仅是突然交换.

                I'm using a UIButton with images for normal and highlighted states. They work as expected but I want to have some fading/merging transition and not just a sudden swap.

                我该怎么做?

                推荐答案

                这可以使用 UIView 的过渡动画来完成.isHighlighted 属性不是动画并不重要,因为它会转换整个视图.

                This can be done using transition animation of a UIView. It does not matter the isHighlighted property is not animatable, because it transitions the whole view.

                UIView.transition(with: button,
                                  duration: 4.0,
                                  options: .transitionCrossDissolve,
                                  animations: { button.isHighlighted = true },
                                  completion: nil)
                

                目标-C

                [UIView transitionWithView:button
                                  duration:4.0
                                   options:UIViewAnimationOptionTransitionCrossDissolve
                                animations:^{ button.highlighted = YES; }
                                completion:nil];
                

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

                上一篇:如何在 UIImage 上像 UIButton 一样在点击时实现突出显示? 下一篇:如何在 Swift 中创建一个圆形按钮?

                相关文章

                  • <bdo id='8uAl3'></bdo><ul id='8uAl3'></ul>
                1. <small id='8uAl3'></small><noframes id='8uAl3'>

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

                  <legend id='8uAl3'><style id='8uAl3'><dir id='8uAl3'><q id='8uAl3'></q></dir></style></legend>

                  1. <tfoot id='8uAl3'></tfoot>