@property parameters
copy:nsstring;
Strong: General Objects
Weak:ui controls
Assign: Basic data type
Instancetype
Instancetype on a type representation, as with an ID , can represent any object type
Instancetype can only be used on return value types and cannot be used as an ID on parameter types
One benefit of instancetype than ID: The compiler detects the true type of instancetype
Dictionary Turn Model:
Disadvantages of using dictionaries
In general, both the set data and the fetch data use " String type key", when writing these keys, the compiler will not have any friendly prompts, need to hand knock
dict[@ "name"] = @ "Jack";
NSString *name = dict[@ "name"];
Hand knocking string key,key easy to write wrong
If the Key is incorrectly written, the compiler will not have any warnings or errors, resulting in incorrect data or incorrect data.
Benefits of using Models
The so-called model, in fact, is the data model, specifically used to hold the data object, use it to represent the data will be more professional
The model sets the data and takes out the data through its properties, the property name if the error is written, the compiler will immediately error, so that the correctness of the data
When using a model to access properties, the compiler provides a series of hints to improve coding efficiency
App.name = @ "Jack";
NSString *name = app.name;
StoryBoard: Describes the software interface, heavyweight, generally used to describe all the interfaces of the entire software
Xib: Describes the software interface, lightweight, generally used to describe the local interface
Use of Xib
the Xib file can be used to describe a piece of local UI interface
loading of Xib files
Method 1
Nsarray *OBJS = [[nsbundle mainbundle] loadnibnamed:@ "Mjappview" owner :nil options:nil];
This method creates all the objects in the Xib and places the objects in the Objs array in order
(If xib is shown in the image on the right, then there are 3 objects in the OBJS array :1 UIView,1 UIButton ,1 x uiswitch)
Method 2
The bundle parameter can be nil, the default is the main bundle
uinib *nib = [uinib nibwithnibname:@ "Mjappview" bundle: [nsbundle Mainbundle]];
Nsarray *OBJS = [nib instantiatewithowner:nil options:nil];
In the development phase , the developer-oriented is the xib file ; When the app is loaded on the phone , the Xib file is converted to a nib file
to encapsulate a custom view using Xib
1> Create a custom view that inherits UIView , assuming the class name is called (mjappview)
2> Create a new mjappview.xib file to describe the structure inside the mjappview
3> Modify The type of UIView to Mjappview True Type
4> Property Wiring of the inner child controls to Mjappview
5> Mjappview provides a model property
6> Override the Set method of the Model property , because the model data passed in the set method can be obtained
7> detach the Model data to set the data to the corresponding child controls
8> Supplement : provides a class method for creating Mjappview that masks The code that reads the Xib file .
iOS notes 1