我在iphone中的代码有什么错误

时间:2012-12-11 13:48:14

标签: iphone

我是i phone手机编程的新手。在这段代码中,我将图像存储在数组中,我已添加到图像中,我可以在缩略图中显示该图像。同样,我在文档目录中创建了私有文件夹,我有添加2个图像,之后我在数组中检索图像,但我无法在缩略图中显示私人文档目录图像但我能够显示捆绑图像。在下面的代码2 localImages有一个localImages我有商店捆绑图像和还有一个localImages我有存储私人文档目录文件夹images.Now捆绑图像正在显示,但我评论说捆绑localImages.and我使用私有文档目录图像在相同的localImages中,它不显示一些Expection。

paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
documentsDirectory = [paths objectAtIndex:0];
savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Tauky"];
     NSLog(@"%@",savedImagePath);
NSError *error = nil;
if (![[NSFileManager defaultManager] fileExistsAtPath:savedImagePath])
[[NSFileManager defaultManager] createDirectoryAtPath:savedImagePath withIntermediateDirectories:NO attributes:nil error:&error];
dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:savedImagePath error:&error];
localImages = [[NSArray alloc] init];

    predicate = [NSPredicate predicateWithFormat:@"self ENDSWITH '.jpeg'"];
    imagesOnly = [dirContents filteredArrayUsingPredicate:predicate];
    localImages = [NSArray arrayWithArray:imagesOnly];
    NSLog(@"%@",localImages);

self.title = @"FGallery";
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

localCaptions = [[NSArray alloc] initWithObjects:@"images53", @"image57",nil];
//localImages =[[NSArray alloc] initWithObjects: @"lava.jpeg",@"hawaii.jpeg",nil];
    NSLog(@"%@",localImagess);

Expection低于代码

- (void)reloadGallery
{
    _currentIndex = _startingIndex;
    _isThumbViewShowing = NO;

    // remove the old
    [self destroyViews];

    // build the new
    if ([_photoSource numberOfPhotosForPhotoGallery:self] > 0) {
        // create the image views for each photo
        [self buildViews];

        // create the thumbnail views
        [self buildThumbsViewPhotos];

        // start loading thumbs
        [self preloadThumbnailImages];

        // start on first image
        [self gotoImageByIndex:_currentIndex animated:NO];

        // layout
        [self layoutViews];
    }
}

在控制台中显示如下

self=(FGalleryViewController *)0x6877050
    _cmd=(SEL)0x103cf reloadgallery

我没有尝试过这么多方法。请帮助我 感谢

1 个答案:

答案 0 :(得分:2)

您为方法reloadGallery命名,但您似乎将其称为reloadgallery(请注意小写'g'!)。将通话更改为reloadGallery,应该没问题。