扫码关注官方订阅号
一个textfield只在上半部分加圆角怎么做
小伙看你根骨奇佳,潜力无限,来学PHP伐。
写一个uitextfield的分类,主要代码参考如下:
参考
- (void)applyRoundCorners:(UIRectCorner)corners radius:(CGFloat)radius { UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath; self.layer.mask = maskLayer; } //再调用即可 [self.yourtextfield applyRoundCorners:UIRectCornerTopLeft|UIRectCornerTopRight radius:5];
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
写一个uitextfield的分类,主要代码
参考如下: