ITeye博客

objective-c

共 3 篇文章

字符串处理函数

#import <Foundation/Foundation.h> int main(int argc,const char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSDate *date = [NSDate date]; NSLog(@"%@",date); NSDate *yestoday = [NSDate dateWithTimeIntervalSinceNow: -(24*60*60)]; NSLog(@"yestoday is %@",yestoday); NSString *…

2012-12-21 13:40 · objective-c

cocoa框架常用类

NSString 字符串类 常见方法 stringWithFormat 格式化字符串 length 获取字符串长度 isEqualToString 比较字符串是否相等 caseInsensitiveCompare 区分大小写比较 uppercaseString 转转字符串为大写 lowercaseString 转换字符串为小写 substringToIndex 从开始处截取字符串 substringWithRange 截取字符串 rangeOfString 查找指定字符串 stringWithContentsOfFile 把文件内容读入字符串 pathExtension 获取文件扩展名 st…

2011-07-01 14:52 · objective-c

objectice-c开门大吉

#import "MySquare.h" int main(int argc,const char *argv[]) { MyRectangle *rec = [[myrectangle alloc] initWidthHeight: 2 andHeight:5]; [rec area]; MySquare *squa = [[mysquare alloc] initWidthSize: 4]; [squa area]; if([squa ismemberofclass: [myrectangle class]]) { printf("squa isMemberOfClass MyRecta…

2011-05-20 12:13 · objective-c · C · C++ · Objective-C · C#