扫码关注官方订阅号
比如这样
光阴似箭催人老,日月如移越少年。
一个建议:一般这种情况,我们都是用图片的,设置按钮的背景图片就好了。
自定义一个Button吧
@implementation CustomButton - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setupLayersWithFrame:frame]; } return self; } - (void)setupLayersWithFrame:(CGRect)frame{ CAShapeLayer * roundedrect = [CAShapeLayer layer]; roundedrect.frame = CGRectMake(0, 0, frame.size.width, frame.size.height); roundedrect.fillColor = [UIColor whiteColor].CGColor; roundedrect.strokeColor = [UIColor colorWithRed:0.329 green: 0.329 blue:0.329 alpha:1].CGColor; roundedrect.lineDashPattern = @[@5.5, @4.5]; roundedrect.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, frame.size.width , frame.size.height) cornerRadius:20].CGPath; [self.layer addSublayer:roundedrect]; }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
一个建议:一般这种情况,我们都是用图片的,设置按钮的背景图片就好了。
自定义一个Button吧