Nsclassfromstring,nsselectorfromstring,iskingofclass
1. nsclassfromstring
This method determines whether the class exists, and if it is present, it is loaded dynamically, and returns an empty object if it is not saved.
ID MYOBJ = [[Nsclassfromstring (@ "Myspecialclass") alloc] init];
Normally equivalent to: id MYOBJ = [[Myspecialclass alloc] init];
Advantages:
1, weaken the connection, so does not link the absence of the framework to the program.
2, import is not required because the class is dynamically loaded and can be loaded as long as it exists. So if you do not have a header file definition for a class in your toolchain, and you are sure that the class is available, you can use this method.
2. nsselectorfromstring
This method complements the previous method and is also a dynamic loading instance method.
Sel sel = nsselectorfromstring (@ "Dosomethingmethod:")//Note the colon, indicating that the method has parameters
if ([object Respondstoselector:sel]) {
[Object Performselector:sel Withobject:color]; Note If there are two parameters, use two withobject: parameter;
}
3. Iskindofclass
Iskindofclass we can also use Iskindofclass to check whether an object is a member of a class
4. Ismemberofclass
The Ismemberofclass method is to determine whether an object is a member of a class
5. The difference between Initwithcoder and initWithFrame Initwithcoder is called when a class is created in IB but is instantiated in Xocdde. For example, create a controller's nib file with IB, Then the controller is instantiated by Initwithnibname in XOCDE, and the controller's initwithcoder is called.
initWithFrame is a user-created UIView subclass that is called when an instance is
6. UIView Autoresizingmask
If the view's Autoresizessubviews property declaration is set to Yes, its child view is automatically resized based on the value of the Autoresizingmask property. Simply configuring the automatic sizing mask for the view often allows the application to get the appropriate behavior, otherwise the application must provide its own implementation by overloading the Layoutsubviews method.
Self.autoresizingmask = uiviewautoresizingflexiblewidth;//If the constant is set, the width of the view will change proportionally with the width of the parent view. Otherwise, the width of the view remains the same.
Uiviewautoresizingnone
If this constant is set, the view will not be automatically resized.
Uiviewautoresizingflexibleheight
If this constant is set, the height of the view will change proportionally with the height of the parent view. Otherwise, the view's height will remain unchanged.
Uiviewautoresizingflexiblewidth
If this constant is set, the width of the view will change proportionally with the width of the parent view. Otherwise, the width of the view remains the same.
Uiviewautoresizingflexibleleftmargin
If this constant is set, the left edge of the view adjusts proportionally as the width of the parent view changes. Otherwise, the relative position of the view and its parent view's left edge remains the same.
Uiviewautoresizingflexiblerightmargin
If this constant is set, the right edge of the view adjusts proportionally as the width of the parent view changes. Otherwise, the relative position of the right edge of the view and its parent view remains the same.
Uiviewautoresizingflexiblebottommargin
If this constant is set, the bottom edge of the view adjusts proportionally as the height of the parent view changes. Otherwise, the relative position of the bottom boundary of the view and its parent view remains unchanged.
Uiviewautoresizingflexibletopmargin
If this constant is set, the top bounds of the view will adjust proportionally as the parent view height changes. Otherwise, the relative position of the top boundary of the view and its parent view remains unchanged.
Whether iOS exists in the project, the reflection that is used that little thing