1. Gradient fill of the UIView view
Override Func Viewdidload () {
Super.viewdidload ()
Additional setup after loading the view, typically from a nib.
Drawing of gradient fill color
Let rect = CGRect (x:30, y:60, width:200, height:200)
Let Gradientview = UIView (frame:rect)
Let Gradientlayer = Cagradientlayer ()
Gradientlayer.frame = Gradientview.frame
Let Fromcolor = Uicolor.yellowcolor (). Cgcolor
Let Midcolor = Uicolor.redcolor (). Cgcolor
Let Tocolor = Uicolor.purplecolor (). Cgcolor
Gradientlayer.colors = [Fromcolor,midcolor,tocolor]
Adds a set of gradient layers to the layer of the View object.
View.layer.addSublayer (Gradientlayer)
Adds a view object to the root view of the current View controller
Self.view.addSubview (Gradientview)
}
2. Textures for UIView views
Override Func Viewdidload () {
Super.viewdidload ()
Additional setup after loading the view, typically from a nib.
Tile the entire screen with imported pictures as textures
Let image = UIImage (named: "Sample")
Creates a new color object, assigns the imported picture to the object
Let PatternColor = Uicolor.init (patternimage:image!)
Self.view.backgroundColor = PatternColor
}
Continuous update ...
Ios-uiview operation (SWift)