123456789101112131415161718192021222324252627282930313233343536 |
- //
- // IHGuetsView.swift
- // Inhealth
- //
- // Created by weclouds on 2020/1/20.
- // Copyright © 2020 weclouds. All rights reserved.
- //
- import UIKit
- class IHGuetsView: UIView {
-
- @IBOutlet weak var imageView: UIImageView!
-
- @IBOutlet weak var box: UIView!
-
-
- override func awakeFromNib() {
- super.awakeFromNib()
- }
-
- func createUI() {
- let width : CGFloat = 325
- let height : CGFloat = 350
- let r : CGFloat = (width * 0.5 * width * 0.5 + 35 * 35 ) / (2 * 35)
- let path0 = UIBezierPath(rect: CGRect(x: 0, y: 0, width: width, height: height - 35))
- path0.addArc(withCenter: CGPoint(x: width * 0.5, y: height - r), radius: r, startAngle: 1 / 4 * .pi, endAngle: 3 / 4 * .pi, clockwise: true)
-
- let masklayer = CAShapeLayer()
- masklayer.frame = self.imageView.bounds
- masklayer.path = path0.cgPath
- self.imageView.layer.mask = masklayer
- box.allRoundShadow()
- }
- }
|