版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ljc_563812704/article/details/84071930
创建控件
UIView * view = [[UIView alloc] initWithFrame:CGRectMake(WIDTH/2-85, self.frame.size.height-15, 170, 30)];
view.hidden = YES;
view.backgroundColor = [UIColor whiteColor];
view.clipsToBounds = YES;
view.layer.cornerRadius = 5;
[self addSubview:view];
添加阴影
UIBezierPath *shadowPath = [UIBezierPath
bezierPathWithRect:view.bounds];
view.layer.masksToBounds = NO;
扫描二维码关注公众号,回复:
4176837 查看本文章
view.layer.shadowColor = [UIColor lightGrayColor].CGColor;
view.layer.shadowOffset = CGSizeMake(0.0f, 1.0f);
view.layer.shadowOpacity = 0.5f;
view.layer.shadowPath = shadowPath.CGPath;