-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCardView.swift
30 lines (25 loc) · 867 Bytes
/
CardView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// CardView.swift
//
//
// Created by Zeeshan Ashraf on 27/11/2018.
//
import Foundation
import UIKit
@IBDesignable
class CardVu: UIView {
@IBInspectable var cornerradius: CGFloat = 2
@IBInspectable var shadowOffsetWidth: Int = 0
@IBInspectable var shadowOffsetHeight: Int = 3
@IBInspectable var shadowcolor: UIColor? = UIColor.black
@IBInspectable var shadowopacity: Float = 0.5
override func layoutSubviews() {
layer.cornerRadius = cornerradius
let shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerradius)
layer.masksToBounds = false
layer.shadowColor = shadowcolor?.cgColor
layer.shadowOffset = CGSize(width: shadowOffsetWidth, height: shadowOffsetHeight);
layer.shadowOpacity = shadowopacity
layer.shadowPath = shadowPath.cgPath
}
}