Last active
October 17, 2018 16:46
-
-
Save soyoes/5df2906e7980d87bc7a6 to your computer and use it in GitHub Desktop.
OBJC Tips
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
* strong, weak, assign | |
http://stackoverflow.com/questions/8927727/objective-c-arc-strong-vs-retain-and-weak-vs-assign | |
* bridge (void* => id, id => void*) | |
http://stackoverflow.com/questions/18976016/how-to-specify-property-to-c-pointer-in-arc-environment | |
* arr.indexOf | |
```Objective-C | |
//BAD: it returns max int. | |
(int)[arr indexOfObject:obj]>0 | |
//Good | |
[arr indexOfObject:obj]==NSNotFound | |
//Better | |
[arr containsObject:obj] | |
``` | |
* str format | |
use "%llu", for long long | |
* use long long instead of long |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment