摘要:
oc 中的.m 这是objective c语言oc 中的.mm这是objective c++语言 阅读全文
posted @ 2015-08-18 15:23
netcorner
阅读(3390)
评论(0)
推荐(0)
摘要:
1、和以前新建新文件一样。2、当然选IOS啦,不过OS X也有这个选项,然后Objctive-C File。3、在File Type里选就OK啦。 阅读全文
posted @ 2015-08-18 14:27
netcorner
阅读(579)
评论(0)
推荐(0)
摘要:
#import #import "AppDelegate.h"int (^max)(int,int);//定义代码块,类似c的函数指针typedef void (^SayHello)(); //指定一个类型的代码块;int main(int argc, char * argv[]) { //通... 阅读全文
posted @ 2015-08-18 14:22
netcorner
阅读(488)
评论(0)
推荐(0)
摘要:
#import #import "AppDelegate.h"int main(int argc, char * argv[]) { //固定的字典类型 NSDictionary *dict=@{@"name":@"Netcorner",@"sex":@"male"}; NSLog... 阅读全文
posted @ 2015-08-18 14:12
netcorner
阅读(227)
评论(0)
推荐(0)
摘要:
#import #import "AppDelegate.h"int main(int argc, char * argv[]) { //固定数组 NSArray *arr=@[@"Hello",@"Netcorner"]; for(int i=0;i<[arr count];i+... 阅读全文
posted @ 2015-08-18 13:59
netcorner
阅读(192)
评论(0)
推荐(0)
摘要:
#import #import "AppDelegate.h"int main(int argc, char * argv[]) { NSString *str=@"Hello OC";//普通字符定义 NSString *str1=[NSString stringWithFormat:... 阅读全文
posted @ 2015-08-18 13:38
netcorner
阅读(244)
评论(0)
推荐(0)
摘要:
通过上例看oc创建实例有点麻烦,oc里面可以创建工厂方法可以让这个操作更简单一些(其实就是c#或者java里面的静态方法)。新建一个“Cocoa Touch Class”文件,命名为PeoplePeople.h 写入@interface People : NSObject{ int _age;... 阅读全文
posted @ 2015-08-18 13:25
netcorner
阅读(688)
评论(0)
推荐(0)
摘要:
新建一个“Cocoa Touch Class”文件,命名为PeoplePeople.h 写入@interface People : NSObject@property int age;@endPeople.m写入(其实是自动产生的)@implementation People@end使用场合:i... 阅读全文
posted @ 2015-08-18 13:08
netcorner
阅读(1642)
评论(0)
推荐(0)

浙公网安备 33010602011771号