控件四周阴影

self.contentView.layer.cornerRadius = 4.0f;

        self.contentView.layer.masksToBounds = YES;

        self.layer.shadowColor = [UIColor grayColor].CGColor;

//        self.layer.shadowOffset = CGSizeMake(3, 3);//有偏移量的情况,默认向右向下有阴影

        self.layer.shadowOffset = CGSizeZero; //设置偏移量为0,四周都有阴影

        self.layer.shadowRadius = 3.0f;//阴影半径,默认3

        self.layer.shadowOpacity = 0.3f;//阴影透明度,默认0

        self.layer.masksToBounds = NO;

        self.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:self.layer.cornerRadius].CGPath;*

你可能感兴趣的:(控件四周阴影)