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
| 预处理器在C/C++/Objective-C语言中提供的宏 | |
| * __func__%s 当前函数签名 | |
| * __LINE__ %d 在源代码文件中当前所在行数 | |
| * __FILE__ %s 当前源代码文件全路径 | |
| * __PRETTY_FUNCTION__ %s 像 __func__,但是包含了C++代码中的隐形类型信息。 | |
| 在Objective-C使用的一些日志信息 | |
| * NSStringFromSelector(_cmd) %@ 当前selector名称 |
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
| /** | |
| * NSString *current_dir = [NSString stringWithFormat:@"%s",__FILE__]; | |
| * NSString *result_dif = [self getDirectory:current_dir withBeforeLevel:2]; | |
| * | |
| * result: | |
| * current_dir = /Users/myname/work/git/rails-like-dir-example/rails-like-dir-example/AppDelegate.m | |
| * result dir = /Users/myname/work/git/rails-like-dir-example/ | |
| */ | |
| -(NSString *)getDirectory:(NSString *)current_dir withBeforeLevel:(int)blevel |
NewerOlder