一、构建Hello Objective-C
建立项目后在.m结尾文件内
代码如下:
#import <Foundation/Foundation.h>
int main(int argc, const char *argv[])
{
}
代码解读:
#import
NSlog()和@"字符串"
NSlog()格式化字符串
NSString的功能:
BOOL类型
main(int argc, const char *argv[])
调出控制台的快捷键:
BOOL类型示例代码
#import <Foundation/Foundation.h>
// returns NO if the two integers have the same
// value, YES otherwise
BOOL areIntsDifferent (int thing1, int thing2)
{
}
} // areIntsDifferent
// given a YES value, return the human-readable
// string "YES". Otherwise return "NO"
NSString *boolString (BOOL yesNo)
{
} // boolString
int main (int argc, const char *argv[])
{
} // main