Custom Button frame doesn't look as good as Round Rect UIButton

后端 未结 2 803
没有蜡笔的小新
没有蜡笔的小新 2021-01-11 18:32

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

UIBezierPath *stroke = [UIBezierPath bezierPathWithRoundedRect:self.bounds
                                     


        
2条回答
  •  离开以前
    2021-01-11 18:57

    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.

提交回复
热议问题