ios 开发 UIButton 添加圆角和阴影

    CALayer *layer = [CALayer layer];

    layer.frame = CGRectMake(0,0 , 0.7*WIDTH, 40);

    layer.backgroundColor = kColor(244, 139, 100).CGColor;

    layer.shadowOffset = CGSizeMake(1, 10);

    layer.shadowOpacity = 0.7;

    layer.cornerRadius = 20;

    layer.shadowColor = kColor(244, 139, 100).CGColor;

    //这里self表示当前自定义的view

    [self.view.layer addSublayer:layer];


    

    UIButton * HomeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, , 0.7*WIDTH, 40)];

    [HomeButton setTitle:@"返回首页" forState:UIControlStateNormal];

    HomeButton.backgroundColor = kColor(244, 139, 100);

    HomeButton.clipsToBounds = YES;

    HomeButton.layer.cornerRadius = 20;

    [HomeButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];

    HomeButton.titleLabel.font = [UIFont systemFontOfSize:15];

    [self.view addSubview:HomeButton];

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ljc_563812704/article/details/80688480
个人分类: iOS开发
上一篇iOS 开发 UIButton 添加阴影
下一篇ios苹果开发者账号申请流程(2017)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭