2012-12-11 45 views
-2

我是新來的手機編程。在這段代碼中,我有存儲圖像數組中的圖像,我已經添加了圖像捆綁,該圖像我能夠顯示在縮略圖。類似地,我有在文檔目錄中創建私人文件夾那裏我添加了2個圖像,之後,我檢索數組中的圖像,但我不能在縮略圖中顯示私人文檔目錄圖像,但我可以顯示包圖像。在下面的代碼2 localImages有一個localImages我有商店捆綁圖像和一個更localImages我有存儲私人文檔目錄文件夾images.Now捆綁圖像顯示,但我評論說,捆綁localImages.and我使用私人文檔目錄圖像在相同的localImages不工作它顯示一些預期。在我的iphone代碼中有什麼錯誤

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); 

厚望低於代碼

- (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 

我沒有得到我試了很多方法什麼do.Please幫我 感謝

回答

2

你的名字你的方法reloadGallery,但你似乎稱它爲reloadgallery(注意小寫'g'!)。更改電話reloadGallery,它應該沒問題。