<tfoot id='woI81'></tfoot>
      <bdo id='woI81'></bdo><ul id='woI81'></ul>

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

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

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

    3. UIButtonTypeRoundedRect 类型的 UIButton 的着色

      时间:2023-07-06

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

                  <tbody id='zPLpU'></tbody>

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

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

                问题描述

                我希望 UIButton 主题类型的圆角矩形部分是我指定的纯色自定义颜色.我明白了

                I would like the rounded rectangle portion of the subject type of UIButton to be a solid custom color I specify. I understand that

                .setTitleColor : 改变文字颜色.backgroundColor : 改变圆角矩形后面四个饼状角块的颜色

                . setTitleColor : changes the text color . backgroundColor : changes the color of the four pie-shaped corner pieces behind the rounded rectangle

                问题是如何改变圆角矩形部分的颜色.

                The question is how to change the color of the rounded rectangle portion.

                我试过setImage,但图像必须有圆角,并且在按钮改变大小时没有任何价值.它不会缩放到新的大小.

                I have tried setImage, but the image has to have rounded corners, and is of no value when the button changes size. It does not scale to the new size.

                提前致谢.

                推荐答案

                试试

                CALayer *subLayer = [CALayer layer];
                subLayer.frame = self.theButton.bounds;
                subLayer.cornerRadius = 10.0;
                subLayer.opacity = 1.0;
                
                CALayer *imageLayer = [CALayer layer];
                imageLayer.frame = subLayer.bounds;
                imageLayer.cornerRadius = 10.0;
                
                
                imageLayer.masksToBounds = YES;
                imageLayer.opacity = 1.0;
                imageLayer.contents = (id) [UIImage imageNamed:@"your.png"].CGImage;
                
                [subLayer addSublayer:imageLayer];
                
                [self.theButton.layer addSublayer:subLayer];
                

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

                上一篇:将发件人作为 id 或特定类转换为 IBAction 下一篇:如何使用左上角创建圆形 UIButton &amp;仅左下角半径

                相关文章

                <tfoot id='XnFRV'></tfoot>

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

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

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

                  1. <small id='XnFRV'></small><noframes id='XnFRV'>