For detailed code, go to: Https://git.oschina.net/null_248_6948/skinChange
1. Interface Construction
#01. add three buttons to StackView, location set to - +
#02. Supporting line
#03. set tag
#04. Animation Execution
Skinviewtopcons.constant = Skinviewtopcons.constant = = 0? -44:0
Self.view.layoutIfNeeded ()
2. Basic Implementation :
#01. set the skin according to the pictures provided
Bgimageview.image = UIImage (named: "Skin/\ (skinname)/back.png")
Iconbutton.setimage (UIImage (named: "Skin/\ (skinname)/icon.png"), for:. Normal)
#02. Save the current skin in a sandbox
UserDefaults.standard.set (Skinname, Forkey:kskinkey)
Force sync Current skin to sandbox
#03. Set Default skin ( default if skin is stored in sandbox )
UserDefaults.standard.object (Forkey:kskinkey) as? String?? "Chunjie"
3. Multi-Controller skin replacement :
#01. new otherviewcontroller.swift
used to display the skin of a jump to another interface , preserving the skin before switching good
#02. new hjjskintools.swift
1. Set boot display skin ( override method )
2. This is used for processing : returns the corresponding picture after passing in the picture name
4. Toggle Background Color :
#01. write a class method in the tool class to determine the processing callback color
#02. The controller receives and displays the color on the LabelView
Some of the bugs that may occur:
The implementation of the switch skin