CNLiveHotButton.swift 557 Bytes
//
//  CNLiveHotButton.swift
//  metaCode
//
//  Created by open on 2023/6/6.
//

import Foundation

class HotButton : UIButton {
    
    override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
        var bounds = self.bounds
        //若原热区小于64x64,则放大热区,否则保持原大小不变
        let width = max(64.0 - bounds.size.width, 0)
        let height = max(64.0 - bounds.size.height, 0)
        bounds = CGRectInset(bounds, -0.5*width, -0.5*height)
        return CGRectContainsPoint(bounds, point)
    }
}