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

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

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

      <tfoot id='Q3UkP'></tfoot>
        <bdo id='Q3UkP'></bdo><ul id='Q3UkP'></ul>
    1. 自定义按钮框架看起来不如圆形矩形 UIButton

      Custom Button frame doesn#39;t look as good as Round Rect UIButton(自定义按钮框架看起来不如圆形矩形 UIButton)

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

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

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

                <bdo id='N4MKr'></bdo><ul id='N4MKr'></ul>
              • 本文介绍了自定义按钮框架看起来不如圆形矩形 UIButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试如下绘制自定义按钮框架:

                I'm trying to draw a custom button frame as follows:

                UIBezierPath *stroke = [UIBezierPath bezierPathWithRoundedRect:self.bounds
                                                                  cornerRadius:RECT_CORNECR_RADIUS];
                
                [stroke stroke];
                

                但由于某种原因,拐角曲线看起来比侧面更思考.如果您查看 UIButton 的默认框架,它非常统一.A 是 UIButton,B 是自定义按钮.

                But for some reason the corner curves look thinker than the sides. If you look at the UIButton's default frame it's very uniform. A is a UIButton, B is a custom button.

                任何想法如何使它更像 UIButton.

                Any ideas how I can make it more like the UIButton.

                推荐答案

                您正在抚摸按钮的边界.这会将您的线绘制在视图边缘的中心,因此线的一半粗细在边界之外并且不会被绘制.这就是为什么它在角落里是全厚度的.在边界矩形上使用 CGRectInset (插入线条厚度的一半)并描边那个矩形.

                You are stroking the bounds of your button. This will draw your line centred over the edge the view, so half of the thickness of the line is outside the bounds and is not drawn. This is why it is full thickness in the corners. Use CGRectInset on your bounds rectangle (inset by half the thickness of your line) and stroke THAT rect.

                这篇关于自定义按钮框架看起来不如圆形矩形 UIButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                UIButton title text color(UIButton 标题文本颜色)
                Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                iPhone UIButton - image position(iPhone UIButton - 图像位置)
                UIButton remove all target-actions(UIButton 删除所有目标动作)

                <legend id='T089m'><style id='T089m'><dir id='T089m'><q id='T089m'></q></dir></style></legend><tfoot id='T089m'></tfoot>
                      <tbody id='T089m'></tbody>

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

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

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