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

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

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

        Swift中具有透明背景的按钮边框

        时间:2023-07-07

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

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

                  <bdo id='VDmMQ'></bdo><ul id='VDmMQ'></ul>
                • <small id='VDmMQ'></small><noframes id='VDmMQ'>

                • <tfoot id='VDmMQ'></tfoot>
                • 本文介绍了Swift中具有透明背景的按钮边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何使 UIButton 边框看起来与下图(入门")按钮中的透明背景相似?

                  How can I make a UIButton border to look alike in the below image (the "Getting Started") button with a transparent background?

                  我应该如何使用情节提要或如何以编程方式做到这一点?

                  How should I achieve this using storyboard or how to do it programmatically?

                  推荐答案

                  backgroundColor 设置为 clearColor 使按钮透明.
                  试试下面的代码例子.您可以根据需要配置和更改borderAlpha、cornerRadius 和颜色.

                  Setting the backgroundColor to clearColor makes the button transparent.
                  Try the code below for example. You can configure and vary the borderAlpha,cornerRadius and colours as your want.

                  let borderAlpha : CGFloat = 0.7
                  let cornerRadius : CGFloat = 5.0
                  
                  button.frame = CGRectMake(100, 100, 200, 40)
                  button.setTitle("Get Started", forState: UIControlState.Normal)
                  button.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Normal)
                  button.backgroundColor = UIColor.clearColor()
                  button.layer.borderWidth = 1.0
                  button.layer.borderColor = UIColor(white: 1.0, alpha: borderAlpha).CGColor
                  button.layer.cornerRadius = cornerRadius
                  

                  这篇关于Swift中具有透明背景的按钮边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:具有自定义边框颜色的 UIButton,iPhone 下一篇:UIButton 不允许 UIScrollView 滚动

                  相关文章

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

                      <tfoot id='o69RN'></tfoot>

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