You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 lines
919 B

//
// ShadowView.swift
// GME Remit
//
// Created by InKwon James Kim on 28/08/2019.
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
import UIKit
class ShadowView: UIView {
private var shadowLayer: CAShapeLayer!
private var cornerRadius: CGFloat = 5.0
override func layoutSubviews() {
super.layoutSubviews()
if shadowLayer == nil {
shadowLayer = CAShapeLayer()
} else {
shadowLayer.removeFromSuperlayer()
}
shadowLayer.path = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
shadowLayer.fillColor = UIColor.white.cgColor
shadowLayer.shadowColor = UIColor.black.cgColor
shadowLayer.shadowPath = shadowLayer.path
shadowLayer.shadowOffset = CGSize(width: 0.0, height: 1.0)
shadowLayer.shadowOpacity = 0.3
shadowLayer.shadowRadius = 2
layer.insertSublayer(shadowLayer, at: 0)
}
}