Get the namespace before you use the class
Using JSON to get the class name of the character type and then create the class object, it is necessary to use the character to turn class
Gets the namespace from the info dictionary to the character type
Let NS = Nsbundle.mainbundle (). infodictionary! ["Cfbundleexecutable"] as! String
Let Clss:anyclass? = nsclassformstring (NS + ".") + Character class name)
Let Vcla = Clas as! Uiviewcontroller.type//Convert the class type to the appropriate type
Let VC = Vcla.init ()//Initialize an object
modifying namespaces
Creating controls
Way: Code creation, Xib creation, NIB creation
It is generally necessary to rewrite the init to add the corresponding property or the corresponding object
When you rewrite init in SWITF code creation, you are prompted to create
Required init? (Coder Adecoder:nscoder) {
FatalError ("Init (coder:) have not been implemented")
}
This init is limited by the code that we can only create controls to prevent confusion
Calculates another control formula based on one control
What property of that control is equal to what property of another control multiplied by how much?
Let Masswidth = Nslayoutconstraint (item: Control 1, attribute: Properties of control 1, relatedBy:NSLayoutRelation.Equal (), Toitem: Another control, attr Ibute: corresponding attribute, multiplier: multiple, constant: plus how much)
To set the width of a control
AddConstraint (Masswidth)
Swift character to class, Code creation control