摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要:库中加入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”项,并添...
阅读全文
摘要: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 ...
阅读全文
摘要:NSLog(@"...%@",NSHomeDirectory());
阅读全文
摘要:终端输入:显示defaults write com.apple.finder AppleShowAllFiles TRUEkillall Finder隐藏defaults write com.apple.finder AppleShowAllFiles FALSEkillall Finder
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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];..
阅读全文
摘要: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:@..
阅读全文