摘要: Objective-C 协议类似于java语言中的接口新建文件步骤:Objective-C File ---> File Type = "Protocol"@protocol 1 // 协议 相当于C++语言中的接口 2 @protocol IPeople 3 -(int)getAge; 4 -(... 阅读全文
posted @ 2015-11-28 16:51 金胖胖 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 字典相当于c++ stl中的map字典NSDictionary 1 #import 2 #import "AppDelegate.h" 3 4 int main(int argc, char * argv[]) { 5 // 从@符号创建字典 实际上就是键值对容器 6 NSDi... 阅读全文
posted @ 2015-11-27 19:47 金胖胖 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 数组的使用方式下面是数组:类型NSArray 1 #import 2 #import "AppDelegate.h" 3 4 int main(int argc, char * argv[]) { 5 6 // 通过@符号创建数组 7 NSArray *arr = @[... 阅读全文
posted @ 2015-11-27 19:06 金胖胖 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 1 #import 2 #import "AppDelegate.h" 3 4 int main(int argc, char * argv[]) { 5 NSString *str = @"hello OC"; 6 NSString *str1 = [NSString str... 阅读全文
posted @ 2015-11-26 23:00 金胖胖 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 调用过程更加清晰+为静态方法 1 // 类定义 2 @interface People : NSObject{ 3 int _age; 4 NSString* _name; 5 } 6 // 工厂方法 静态 7 +(People*)peopleWithAge:(int)age an... 阅读全文
posted @ 2015-11-26 22:23 金胖胖 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 主要内容set get方法的使用关键字 @property 全自动生成set get方法 1 // 类的声名 2 @interface People : NSObject{ 3 int _age; // 成员变量 4 } 5 @property int age; // @property... 阅读全文
posted @ 2015-11-26 21:47 金胖胖 阅读(1084) 评论(0) 推荐(0) 编辑
摘要: 1 // 2 // main.m 3 // L02HelloObjC 4 // 5 // Created by JinXin on 15/11/25. 6 // Copyright © 2015年 JinXin. All rights reserved. 7 // 8 9 #import... 阅读全文
posted @ 2015-11-26 19:37 金胖胖 阅读(925) 评论(0) 推荐(0) 编辑
摘要: 为了节省时间,我就贴出来吧头文件SerialPort.h 1 /*************************************************************************************************** 2 * SerialPort.h 3... 阅读全文
posted @ 2015-08-31 19:13 金胖胖 阅读(752) 评论(0) 推荐(1) 编辑
摘要: BOOL CXXXApp::InitInstance() //函数内添加代码 HANDLE hMutex=CreateMutex(NULL,TRUE,"test"); // 用于检测是否多开 if(hMutex) { if(ERROR_ALREADY_EXISTS==GetLa... 阅读全文
posted @ 2015-02-26 11:02 金胖胖 阅读(637) 评论(0) 推荐(0) 编辑