Translate

2012年5月31日 星期四

xcode read plist and txt

注意[NSBundle mainBundle]裡面的檔案是唯讀的不可變動

read plist NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"read" ofType:@"plist"]; NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath]; read txt NSString *txtpath = [[NSBundle mainBundle] pathForResource:@"read" ofType:@"txt"]; NSString *txtText = [NSString stringWithContentsOfFile:txtpath encoding:NSUTF8StringEncoding error:nil];

沒有留言:

張貼留言