Note Of 8-day Obj-C/iOS foundation course
1. rewrite method:init
- (instancetype)init
{
self = [super init];
if (self) {
//self.name = @"RainyTunes";
}
return self;
}
2. nonatomic,atomic,assign,retain,copy
nonatomic -> without thread lock
3. Refering Counting(引用计数)
reference counting is a technique of storing the number of references, pointers, or handles to a resource such as an object, block of memory, disk space or other resource.
It may also refer, more specifically, to a garbage collection algorithm that uses these reference counts to deallocate objects which are no longer referenced.
4. strong,weak
The difference is that an object will be deallocated as soon as there are no strong pointers to it. Even if weak pointers point to it, once the last strong pointer is gone, the object
will be deallocated, and all remaining weak pointers will be zeroed out.
5. method: description
//definitely the same
NSLog(@"%@",[myStr description]);
NSLog(@"%@",myStr);
6. Archive
Archive(归档) = save = serialization
7. UIWindow
The UIWindow class defines an object known as a window that manages and coordinates the views an app displays on a device screen. Unless an app can display content on an external device screen, an app has only one window.
How to init a window:
The two principal functions of a window are to provide an area for displaying its views and to distribute events to the views. To change the content your app displays, you can change the window’s root view; you don’t create a new window.
A window belongs to a level—typically, UIWindowLevelNormal—that represents where it sits on the z-axis relative to other windows. For example, a system alert window appears above normal app windows.