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

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

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

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

    2. 如何使按钮的角变圆

      时间:2023-07-08
        <bdo id='kmcqS'></bdo><ul id='kmcqS'></ul>
        <legend id='kmcqS'><style id='kmcqS'><dir id='kmcqS'><q id='kmcqS'></q></dir></style></legend>

            • <small id='kmcqS'></small><noframes id='kmcqS'>

                  <tbody id='kmcqS'></tbody>
              1. <i id='kmcqS'><tr id='kmcqS'><dt id='kmcqS'><q id='kmcqS'><span id='kmcqS'><b id='kmcqS'><form id='kmcqS'><ins id='kmcqS'></ins><ul id='kmcqS'></ul><sub id='kmcqS'></sub></form><legend id='kmcqS'></legend><bdo id='kmcqS'><pre id='kmcqS'><center id='kmcqS'></center></pre></bdo></b><th id='kmcqS'></th></span></q></dt></tr></i><div id='kmcqS'><tfoot id='kmcqS'></tfoot><dl id='kmcqS'><fieldset id='kmcqS'></fieldset></dl></div>
              2. <tfoot id='kmcqS'></tfoot>
                本文介绍了如何使按钮的角变圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个矩形图像 (jpg),想用它来填充 xcode 中圆角按钮的背景.

                I have a rectangle image (jpg) and want to use it to fill the background of a button with rounded corner in xcode.

                我写了以下内容:

                UIButton *button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
                CGRect frame = CGRectMake(x, y, cardWidth, cardHeight);
                button.frame = frame;
                [button setBackgroundImage:backImage forState:UIControlStateNormal];
                

                但是,我用这种方法得到的按钮没有圆角:它是一个普通的矩形,看起来与我的原始图像完全一样.我怎样才能得到一个圆角的图像来代表我的按钮?

                However, the button I get with that approach doesn't have its corners rounded: it is instead a plain rectangle that looks exactly like my original image. How can I get instead an image with rounded corner to represent my button?

                谢谢!

                推荐答案

                我用 UITextArea 尝试了以下解决方案,我希望这也适用于 UIButton.

                I tried the following solution with the UITextArea and I expect this will work with UIButton as well.

                首先在你的 .m 文件中导入这个 -

                First of all import this in your .m file -

                #import <QuartzCore/QuartzCore.h>
                

                然后在您的 loadView 方法中添加以下行

                and then in your loadView method add following lines

                    yourButton.layer.cornerRadius = 10; // this value vary as per your desire
                    yourButton.clipsToBounds = YES;
                

                这篇关于如何使按钮的角变圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:将按钮添加到 UIPickerView - Swift 1.2 下一篇:以编程方式设置 UIButton 标题 UILabel 字体大小

                相关文章

                <legend id='Mg3vV'><style id='Mg3vV'><dir id='Mg3vV'><q id='Mg3vV'></q></dir></style></legend>
              3. <small id='Mg3vV'></small><noframes id='Mg3vV'>

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