in the Swift Programming (http://www.maiziedu.com/course/ios/16-161/) , we all encounter these two questions, how to turn characters into classes and code to create a control method, the following specific explanation of these two points of knowledge
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
in SWITF  init
required init? (Coder adecoder: nscoder) {
fatalerror ("Init (coder:) has 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: control 1 () multiples how much )
to set the width of a control
AddConstraint (Masswidth)
Character to class in Swift programming, code creation control in detail