에로드하십시오. 내 프로젝트에서 이미지를 내 전화기의 문서 폴더에 저장하고 별도의 테이블 뷰에로드하고 있습니다. 나는 약간의 성공을 거두고 있으며, 마지막으로 찍은 이미지는 테이블에로드되지만 마지막 행 대신 모든 행에로드됩니다. 여기plist에 저장된 모든 이미지를 테이블 뷰
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"List";
ListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//Load PLIST
NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [path objectAtIndex:0];
NSString *plistPath = [NSString stringWithFormat:@"%@/images.plist", documentsDirectory];
//Load PLIST into mutable array
NSMutableArray *imageArray = [NSMutableArray arrayWithContentsOfFile:plistPath];
for (NSDictionary *dict in imageArray) {
//Do whatever you want here, to load an image for example
NSString *imageFilePath = [NSHomeDirectory() stringByAppendingPathComponent:[dict objectForKey:@"Original Image"]];
UIImage *image = [UIImage imageWithContentsOfFile:imageFilePath];
[cell.imageofItem setImage:image];
}
}
을 무슨 일이 일어나고 있는지의 예입니다 : 여기 내가있는 tableview에서 이미지를로드하는 데 사용되는 코드는 내가, 하나는 "10282012_13113138_image.jpg"라고이 사진을 찍어 말해 다른 호출된다 "10282012_13113468_image.jpg". 그런 다음 셀에 이미지를로드하고 마지막 사진을 두 셀에로드합니다.
도움이 될 것입니다.
시도
나는 어떻게 UIImage 이래로 일하고 있는지 잘 모르겠다. '이미지는 for 루프에서 선언되지만 for 루프의 컨텍스트 외부에서 사용되고 있습니다. – bobnoble
@bobnoble 죄송합니다. 잘못 입력했습니다. 이제 –
을 수정했습니다. 어디에서 초기화되었거나 - (void) loadImages에 할당 되었습니까? – yeesterbunny