에 제목은 어떻게 이미지와 plist
에서 임의의 문자열 값을 저장할 수 있으며, 또한 어떻게 다른의 같은 dictionary
으로 파일을 추가 할 수 있습니다 이미지와 이름?저장 이미지와 PLIST
0
A
답변
0
이 링크를 클릭하십시오. 그것은 이미지가
그리고 당신은 다음과 같은 새로운 키를 추가 할 수 있습니다 저장하는 제목 PLIST에 저장하는 방법을 상세하게 제공한다.
// 년에-수집 이미지 & 제목을 작성하는 응용 프로그램
NSString *titleStr = @"Title Of Image";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *path = [NSString stringWithFormat:@"%@/YOURPLIST.plist",
[paths objectAtIndex:0]];
// Place an image in a dictionary that will be stored as a plist
[dictionary setObject:image forKey:@"image"];
[dictionary setObject:titleStr forKey:@"title"];
// Write the dictionary to the filesystem as a plist
[NSKeyedArchiver archiveRootObject:dictionary toFile:path];
+0
효과가 있습니까? – Bhoomi
0
를 사용하여 다음과 같은 코드를 문서 폴더 내에서의 plist의 전체 경로를 얻기 plist-
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"PlistName.plist"];
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath: path])
{
path = [documentsDirectory stringByAppendingPathComponent: [NSString stringWithFormat: @"PlistName.plist"] ];
}
fileManager = [NSFileManager defaultManager];
NSMutableDictionary *dataDictionary=[NSMutableDictionary alloc] init];
[dataDictionary setObject:ImageData forKey:image];
[dataDictionary setObject:ImageTitle forKey:title];
[dataDictionary writeToFile: path atomically:YES];
그리고 이 이미지를 읽으십시오 & 제목은 다음과 같습니다 plier like this-
- (NSDictionary *)readDataFromPlist()
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"PlistName.plist"];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSMutableDictionary *dataDictionary;
if ([fileManager fileExistsAtPath: path])
{
dataDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
return dataDictionary;
}else
return nil;
}
관련 문제
- 1. NSMutableDictionary를 plist iOS에 저장
- 2. Plist 문제 저장 /로드
- 3. plist 파일에 문서 파일 저장
- 4. iPhone - plist 파일에 데이터 저장
- 5. 업데이트를 통해 iOS plist 저장
- 6. PrefPanes & Plist 저장 위치 10.7
- 7. xcode로 plist 할 데이터 저장
- 8. plist 세그먼트 컨트롤 저장 문제
- 9. listview의 원격 이미지와 LRUCache에 저장
- 10. plist 파일에 여러 사전 저장 및 검색
- 11. 작은 수의 NSMutableArrays 저장 (plist 포함)?
- 12. 핵심 데이터 - pList/사전으로 엔티티 저장
- 13. 속성 목록 (plist) 파일에 문자열을 저장 하시겠습니까?
- 14. plist 파일에 Objective-C 코드 저장
- 15. 속성 목록 (plist) 파일에 NaN 저장
- 16. IOS와 함께 Plist 이외의 다른 유형 저장
- 17. 앱 종료 후 내 plist 저장
- 18. 열거 형, PList 또는 다른 저장 장치?
- 19. pList 또는 로컬 폴더에 로컬로 데이터 저장
- 20. PLIST
- 21. 바이너리 plist 대 보통 plist
- 22. 이미지와
- 23. UITableView에 plist 문자열 표시
- 24. UITableView에 plist 표시
- 25. plist 파일에 NSMutableArray의 내용 작성하기
- 26. Xcode에서 plist 파일 만들기
- 27. URL 내용으로 Plist 만들기
- 28. PLIST 이메일 첨부 파일
- 29. .plist 파일에 아래 첨자 쓰기
- 30. plist 작성
it dup licate http://stackoverflow.com/questions/2486705/storing-image-in-plist –
이미지를 어떻게 얻습니까? – user3182143
사진 라이브러리에서 이미지를 선택하거나 번들에서 직접 이미지를 가져 옵니까? – user3182143