GradientView:在iOS和tvOS的UIKit中轻松使用渐变
渐变视图在UIKit中轻松使用渐变。Gradient View是围绕CGGradient的简单UIView包装器。
用法:
// Initialize a gradient view
let gradientView = GradientView(frame: CGRect(x: 20, y: 20, width: 280, height: 280))
// Set the gradient colors
gradientView.colors = [.green, .yellow]
// Optionally set some locations
gradientView.locations = [0.8, 1.0]
// Optionally change the direction. The default is vertical.
gradientView.direction = .horizontal
// Add some borders too if you want
gradientView.topBorderColor = .red
用法:
// Initialize a gradient view
let gradientView = GradientView(frame: CGRect(x: 20, y: 20, width: 280, height: 280))
// Set the gradient colors
gradientView.colors = [.green, .yellow]
// Optionally set some locations
gradientView.locations = [0.8, 1.0]
// Optionally change the direction. The default is vertical.
gradientView.direction = .horizontal
// Add some borders too if you want
gradientView.topBorderColor = .red
GradientView-master.zip
预估大小:22个文件
GradientView-master
文件夹
.gitignore
64B
Sources
文件夹
GradientView
文件夹
GradientView.swift
6KB
Example
文件夹
Screenshots
文件夹
Screenshot2@2x.png
124KB
Screenshot1@2x.png
139KB
ViewController.swift
1KB
246.53KB
文件大小:
评论区