可见性 1.0.0

可见性 1.0.0

darquro 维护。



可见性 1.0.0

  • darquro

logo

CI Status Version License Platform

处理窗口中的视图可见性

使用方法

// start handling visibility
targetView.visibility
    .changed { state in
        switch state {
        case .visible:
            // visible process here
        case .invisible:
            // invisible process here
    }
}

// stop handling visibility
targetView.visibility.invalidate()

配置

您可以使用 setConfig 来更改配置。

targetView.visibility
    .setConfig { config in
        config.timeInterval = 1.0
        config.intersectionRatio = 0.8
        config.transparencyRatio = 0.5
    }
    .changed { state in
        ...
    }
名称 描述 默认
时间间隔 检查视图状态的时间间隔(秒) 0.5
交集比率 视图矩形在 UIWindow 中的可见比率(0<...1.0) 0.5
透明度比率 视图透明度比率(0..<1.0) 0

安装

Visibility 可以通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile 中:

pod "Visibility"

要求

  • Swift 4.0 或更高版本
  • iOS 8.0 或更高版本

作者

darquro

许可证

VerticalAlignmentLabel 使用 MIT 许可证。更多信息请参阅 LICENSE 文件。