1.
In Arc, all *outlet* properties are recommended to use weak, which are already part of view Controller's view hierarchy and do not need to be defined again as strong (the effect in arc is equivalent to retain). The only outlet that should use strong is the File's Owner, which connects to the top-level object of the nib.
Because the two properties of TableView and searchbar are defined as weak, the two variables are automatically set to nil when the object they point to is freed.
When the IOS APP receives a low memory warning, the view Controller's main view is unload and all Subview are released. The UITableView and Uisearchbar objects are automatically released, zeroing weak pointer system will automatically set Self.tableview and Self.searchbar to nil. So you don't have to set it to nil again in Viewdidunload, and when Viewdidunload is called, these two properties are already nil.
This does not mean that you can not need viewdidunload, as long as you keep an object pointer, the object will survive. When you don't need an object, you can manually set the pointer to nil. As in the example code above, SoundEffect = nil; The Viewdidunload () method needs to set all non-outlet variables to nil, as well as the Didreceivememorywarning () method.
2.
The property's modifiers are summarized as follows:
Strong: Equivalent to "retain", property becomes owner of object
Weak: The property is weak pointer, which is automatically set to nil when the object is disposed, remembering Outlet
should use Weak
Unsafe_unretained: Equivalent to the previous "assign", only IOS 4 should be used
Copy: Copy an object and create a strong association as in the previous copy
Assign: The object cannot use assign, but the original type (BOOL, int, float) is still
can use
ARC Automatic Reference Counting learning notes