This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Any time is printed in Console. It isn't application start time. | |
+ initialize method may not invoked or lazily invoked. | |
So if you need the launched time of application, you must write the code in main function. | |
- AppDelegate.m | |
NSString * startTime; | |
- main.m | |
extern NString *startTime; | |
int main(int argc, char* argv[]) { | |
@autoreleasepool { | |
NSDateFormatter *formatter = [NSDateFormatter new]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There is no bug in compile. But It has memory leaks. Because of child.parent = parent when TTChild's @property (automic) TTParent *parent; | |
How to fix? | |
As a way of fixing, you can change the TTChild's parent property. | |
@property (atomic, assign) TTParent *parent;//use assign. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is difference between atomic and nonatomic properties? | |
One of the primary challenges of multi-threaded programming. | |
Atomic properties are necessary in a reference counted multi threaded environment in order to stop objects from disappearing before a thread has a chance to retain them. | |
In nonatomic, no such guarantees are made. Thus, nonatomic is considerably faster than "atomic". | |
2. Which is default for synthesized properties? | |
It is nonatomic. | |
With "atomic", the synthesized setter/getter will ensure that a whole value is always returned from the getter or set by the setter, regardless of setter activity on any other thread. | |
3. When would you use one vs. the others? | |
I have used the "atomic" for multi-threading. In general, i have used the nonatomic property. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are two ways | |
1. Use autolayout constraint in storyboard or xib. | |
When use autolayout contraints, you must layout of element of UIView in viewDidLayout of UIViewController. | |
2. In the code, use setFrame:. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If TTWaitController hasn't xib or storyboard, TTWaitController hasn't view. | |
So you couldn't see the screen. | |
Fix: You must override TTWaitController's loadView. | |
- (void)loadview { | |
self.view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reuse identifier is associated with a UITableViewCell object that the table-view’s delegate creates with the intent to reuse it as the basis (for performance reasons) for multiple rows of a table view. It is assigned to the cell object in initWithFrame:reuseIdentifier: and cannot be changed thereafter. A UITableView object maintains a queue (or list) of the currently reusable cells, each with its own reuse identifier, and makes them available to the delegate in the dequeueReusableCellWithIdentifier: method. |