i have upload the code screenshot, it has changed when i paster the code i don't know why.大家。我已經下載了一個來自GIT的ios示例代碼,我想用它(ReallyBigPhotoLibrary.xcodepro)添加到我的項目中。但是在這裏只顯示一張圖片,而且我有很多圖片,我不知道如何修改它以適合我的項目,請幫幫我。非常感謝。如何創建一個圖像陣列
//
// PhotoDataSource.m
// ReallyBigPhotoLibrary
//
// Created by Kirby Turner on 9/14/10.
// Copyright 2010 White Peak Software Inc. All rights reserved.
//
#import "PhotoDataSource.h"
@implementation PhotoDataSource
- (void)dealloc
{
[data_ release], data_ = nil;
[super dealloc];
}
- (id)init
{
self = [super init];
if (self) {
data_ = [[NSMutableArray alloc] init];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[UIImage imageNamed:@"IMG_0694_th.jpg"], @"thumbnail", [UIImage imageNamed:@"IMG_0694.JPG"], @"fullsize", nil];
[data_ addObject:dict];
}
return self;
}
- (NSInteger)numberOfPhotos
{
NSInteger count = 1000; [data_ count];
return count;
}
// Implement either these, for synchronous images…
- (UIImage *)imageAtIndex:(NSInteger)index
{
NSDictionary *dict = [data_ objectAtIndex:0];
UIImage *image = [dict objectForKey:@"fullsize"];
return image;
}
- (UIImage *)thumbImageAtIndex:(NSInteger)index
{
NSDictionary *dict = [data_ objectAtIndex:0];
UIImage *image = [dict objectForKey:@"thumbnail"];
return image;
}
@end
您的可變數組只有一個對象。你想如何製作以適合你的項目? – jailani
please。我該怎麼做。請幫助我 – smallgood
從哪裏得到圖像。? – Akhilrajtr