iOS 怎么把button的边缘变成虚线
大家讲道理
大家讲道理 2017-04-18 09:43:21
0
2
427


比如这样

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

répondre à tous(2)
洪涛

Une suggestion : Généralement, dans ce cas, nous utilisons des images, et définissons simplement l'image d'arrière-plan du bouton.

迷茫

Personnaliser un bouton

@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];
}
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!