02 2012 档案

NSNotificationCenter
摘要:View Code 1 1. 定义一个方法 2 3 -(void) update{ } 4 5 2. 对象注册,并关连消息 6 7 [[NSNotificationCenter defaultCenter] 8 9 addObserver:self selector:@selector(update) name:@"update" object:nil] 10 11 3. 在要发出通知消息的地方 12 13 [[NSNotificationCenter defaultCenter] 14 15 ... 阅读全文

posted @ 2012-02-21 08:57 AXZON 阅读(329) 评论(0) 推荐(0)

GDataXML的一些简单示例。
摘要:View Code 1 +(NSDictionary *) XmlAnalysisWithString:(NSString *) URLString 2 3 { 4 5 NSError* error; 6 7 NSMutableDictionary * dataDic = [NSMutableDictionary dictionary]; 8 9 //拿出xml文件内容10 11 NSURL * myURL = [NSURL URLWithString:URLString];12 13 NSString* fileContent = [[NSString alloc] initWit... 阅读全文

posted @ 2012-02-12 12:45 AXZON 阅读(189) 评论(0) 推荐(0)

给项目添加GDataXML。
摘要:库中加入libxm 从http://code.google.com/p/gdata-objectivec-client/downloads/list下载“gdata-objective-c client library.” 2. 解压缩文件,找到Source\XMLSupport,并且将其中的GDataXMLNode.h 和 GDataXMLNode.m文件拖到项目中 3. 选中项目,选中“Build Settings”标签页 4. 将Build Settings页中,顶部的“Basic”标签切换到“All” 5. 找到“Paths\Header Search Paths”项,并添... 阅读全文

posted @ 2012-02-11 21:49 AXZON 阅读(157) 评论(0) 推荐(0)

读/写文件
摘要:View Code 1 NSArray *paths; 2 NSString *arrayPath; 3 NSString *urlString; 4 5 paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 6 NSUserDomainMask, YES);//搜索沙盒路径下的document文件夹。 7 arrayPath = [[paths objectAtIndex:0] 8 ... 阅读全文

posted @ 2012-02-10 15:16 AXZON 阅读(125) 评论(0) 推荐(0)

得到沙盒的路径
摘要:NSLog(@"...%@",NSHomeDirectory()); 阅读全文

posted @ 2012-02-10 14:49 AXZON 阅读(91) 评论(0) 推荐(0)

MAC OS隐藏/显示 文件夹
摘要:终端输入:显示defaults write com.apple.finder AppleShowAllFiles TRUEkillall Finder隐藏defaults write com.apple.finder AppleShowAllFiles FALSEkillall Finder 阅读全文

posted @ 2012-02-10 14:48 AXZON 阅读(153) 评论(0) 推荐(0)

奇葩问题。程序突然无法运行了
摘要:Couldn't register com.mycompany.MyApp with the bootstrap server. Error: unknown error code.This generally means that another instance of this process was already running or is hung in the debugger.1. 重新Xcode2. 重启device3. clean4. rebuild 阅读全文

posted @ 2012-02-10 14:46 AXZON 阅读(156) 评论(0) 推荐(0)

UIImage保存为JPG,PNG的方法
摘要:View Code 1 / Create paths to output images 2 NSString *pngPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.png"]; 3 NSString *jpgPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.jpg"]; 4 5 // Write a UIImage to JPEG with minimum 阅读全文

posted @ 2012-02-09 23:55 AXZON 阅读(393) 评论(0) 推荐(0)

收集的一些常用的转换。
摘要:View Code 1 . NSData 与 NSString 2 3 NSData-> NSString 4 5 NSString *aString = [[NSString alloc] initWithData:adataencoding:NSUTF8StringEncoding]; 6 7 8 9 NSString->NSData 10 11 NSString *aString = @"1234abcd"; 12 13 NSData *aData = [aString dataUsingEncoding: NSUTF8StringEncoding];.. 阅读全文

posted @ 2012-02-09 23:53 AXZON 阅读(204) 评论(0) 推荐(0)

UIImage转NSString的注意事项。
摘要:UIImage转换成NSData后需要先将NSData转成BASE64View Code 1 //To convert an image to string you need a method to convert NSData to a base64Encoded string and back (lots of examples here). The easiest ones to use are categories on NSData so you can do something like this: 2 3 UIImage* pic =[UIImage imageNamed:@.. 阅读全文

posted @ 2012-02-09 23:35 AXZON 阅读(496) 评论(1) 推荐(0)

导航