成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

詳解Cocoa Touch讀寫Plist項目開發(fā)代碼

移動開發(fā) iOS
本文介紹的是Cocoa Touch讀寫Plist項目開發(fā)代碼,主要是基于代碼來實現(xiàn)Cocoa Touch讀寫Plist的內容,來看詳細代碼。

Cocoa Touch讀寫Plist項目開發(fā)代碼是本文要介紹的內容,內容不多,本文基于代碼實現(xiàn)Cocoa Touch讀寫Plist,不多說,直接來看代碼。

  1. - (void) getTopData {  
  2.  
  3.    NSString *documentDirectory = [self getDocumentDirectory];  
  4.    NSString *fileName = @"top2.plist";  
  5.    NSString *finalPath = [documentDirectory stringByAppendingPathComponent: fileName];  
  6.  
  7.    NSMutableDictionary *topRoot = [[NSMutableDictionary alloc] initWithContentsOfFile: finalPath];  
  8.    NSLog(@"%d",[topRoot count]);  
  9. }  
  10.  
  11. - (void) setTopData {  
  12.  
  13.    NSFileManager *fileManager = [NSFileManager defaultManager];  
  14.    NSString *documentDirectory = [self getDocumentDirectory];  
  15.    NSString *fileName = @"top2.plist";  
  16.    NSString *finalPath = [documentDirectory stringByAppendingPathComponent: fileName];  
  17.  
  18.    if (![[NSFileManager defaultManager] fileExistsAtPath: finalPath]) {  
  19.      [fileManager changeCurrentDirectoryPath: [documentDirectory stringByExpandingTildeInPath]];  
  20.  
  21.      NSString *topPath = [[NSBundle mainBundle] pathForResource: @"top" ofType: @"plist"];  
  22.      NSData *topRoot = [NSDictionary dictionaryWithContentsOfFile: topPath];  
  23.  
  24.      [fileManager createFileAtPath:fileName contents: topRoot attributes:nil];  
  25.  
  26.    }else {  
  27.      NSLog(@"file is here!");  
  28.      NSData *topRoot = [[NSMutableDictionary alloc] initWithContentsOfFile: finalPath];  
  29.      [topRoot setValue: @"oo" forKey: [NSString stringWithFormat: @"key%d",arc4random()%1000]];  
  30.      [topRoot writeToFile: finalPath atomically: NO];  
  31.      [fileManager createFileAtPath:fileName contents: topRoot attributes:nil];  
  32.      [topRoot release];  
  33.    }  
  34. }  
  35.  
  36. - (NSString *)getDocumentDirectory {  
  37.    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);  
  38.    return [paths objectAtIndex: 0];  

小結:詳解Cocoa Touch讀寫Plist項目開發(fā)代碼的內容介紹完了,希望通過本文的學習能對你有所幫助!

責任編輯:zhaolei 來源: 互聯(lián)網(wǎng)
相關推薦

2011-07-08 18:03:30

Cocoa Touch 網(wǎng)絡

2011-06-15 16:11:51

UIKitCocoa TouchiOS

2011-08-11 15:46:55

CocoaCocoa Touch框架

2011-05-11 10:28:03

2011-07-18 15:08:34

2011-07-08 11:13:42

Cocoa Touch XCode

2011-08-03 10:24:22

Cocoa Touch 靜態(tài)庫

2011-08-05 17:54:33

Cocoa Touch 多語言

2011-07-08 10:49:59

Cocoa Touch 靜態(tài)庫

2011-05-31 15:41:00

Cocoa TouchCocoaiOS

2011-07-20 14:41:53

Cocoa Zip 框架

2011-08-10 18:47:18

Cocoa字符串

2011-06-27 15:39:51

Cocoa Touch

2011-06-27 16:00:34

視頻教程Cocoa TouchiOS應用

2011-08-15 14:27:51

CocoaRunLoop

2011-08-02 13:58:18

Cocoa 框架 Mac OS

2011-08-15 14:47:28

Cocoa嵌入資源文件

2011-07-26 15:29:36

Cocoa 模式

2011-07-28 16:52:34

Cocoa 框架 Mac Os

2023-07-07 08:36:45

配置注解jar
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 午夜在线免费观看视频 | 91www在线观看| 成人免费在线播放 | 欧美成ee人免费视频 | 99国产精品99久久久久久 | 国产一区二区在线看 | 国产精品女人久久久 | www.嫩草 | 国产欧美在线观看 | 欧美日韩视频在线 | 日日夜夜天天干 | 久久中文字幕一区 | 91一区二区| 成人夜晚看av | 中文字幕一区在线观看视频 | 在线视频一区二区三区 | 九九精品在线 | 亚洲精品99 | 亚洲成人精品国产 | 精品在线99| 国产精品视频在线播放 | 亚洲女人天堂成人av在线 | 久久久精品视频免费看 | 国产综合视频 | 精品国产一区三区 | 在线观看免费国产 | 欧美电影免费观看高清 | 欧美福利专区 | 国产成都精品91一区二区三 | 日韩在线播放网址 | 插插插干干干 | 米奇成人网 | 99成人| 一区在线视频 | 日日操视频 | 国产一级在线观看 | 99亚洲综合 | 亚洲精品白浆高清久久久久久 | www.99re| 亚洲人在线播放 | 亚洲综合区 |