SSNeumorphicView
SSNeumorphicView 用于在 iOS 中构建 Neumorphism 视图、按钮和文本字段。
功能!
- 使用 SSNeumorphicView 创建 Neumorphism 视图、按钮和文本字段
示例
要运行示例项目,请克隆仓库,然后从示例目录首先运行 pod install
。
要求
- iOS 10.0+
- Xcode 9+
安装
CocoaPods 您可以通过将其添加到 Podfile 中来使用 CocoaPods 安装 SSNeumorphicView。
use_frameworks!
pod 'SSNeumorphicView'
使用示例
在故事板中添加一个UIView,并将其类更改为SSNeumorphicView
将Neumorphic包导入到你的视图中。
import SSNeumorphicView
使用外部阴影创建NeumorphicView。
@IBOutlet weak var viewNeumorphic: SSNeumorphicView! {
didSet {
viewNeumorphic.viewDepthType = .outerShadow
}
}
使用内部阴影创建Neumorphic文本字段。
@IBOutlet weak var txtSSNeumorphic: SSBaseTextField! {
didSet {
txtSSNeumorphic.txtDepthType = .innerShadow
}
}
使用外部阴影创建Neumorphic按钮。
@IBOutlet weak var btnNeumorphic: SSNeumorphicButton! {
didSet {
btnNeumorphic.btnDepthType = .outerShadow
}
}
创建拥有内部阴影的Neumorphic圆角按钮。
@IBOutlet weak var btnRoundedNeumorphic: SSNeumorphicButton! {
didSet {
btnRoundedNeumorphic.btnDepthType = .innerShadow
btnRoundedNeumorphic.layer.masksToBounds = true
btnRoundedNeumorphic.btnNeumorphicCornerRadius = btnRoundedNeumorphic.frame.width/2
}
}
待办事项
支持暗黑模式
许可证
SSNeumorphicView遵循MIT许可证。有关更多信息,请参阅LICENSE文件。