2014-01-06 70 views
0

我正在使用MWPhotoBrowser在導航中顯示圖像。對於多個圖像,它工作正常。但是當顯示一個圖像(圖像數量是1)時,它不會顯示圖像名稱作爲導航欄的標題。我如何解決這個問題?這裏是委託方法的代碼:MWPhotoBrowser不顯示導航標題中單個圖像的顯示圖像名稱

- (void) photoBrowser:(MWPhotoBrowser *)photoBrowser didDisplayPhotoAtIndex:(NSUInteger)index { 
NSLog(@"Photo displayed"); 
if (index < [self.imagesGallery count]) { 
    NSString *imageName = [self.imagesGallery objectAtIndex:index]; 

    photoBrowser._titleText = [imageName stringByDeletingPathExtension]; 
    NSLog(@"Title: %@", photoBrowser._titleText); 
    NSString *element = [[[imageName stringByDeletingPathExtension] componentsSeparatedByString:@"-"] objectAtIndex:1]; 
    int index_ = [deficiencesShort indexOfObject:element]; 
    photoBrowser._actionButton.title = [NSString stringWithFormat:@"Go To %@ Deficiency", [deficiences objectAtIndex:index_]]; 
} 

}

對於單個圖像,的NSLog(@「名稱:%@」,photoBrowser._titleText)顯示圖像的名稱作爲輸出,但不設定爲導航欄標題

回答

1

也許你使用MWPhotoBrowser庫進行了一些更改,讓我看看你的代碼。的MWPhotoBrowser的導航

設置標題:

  1. 在MWPhoto添加name屬性
  2. 修改updateNavigation方法,handleMWPhotoLoadingDidEndNotification,傳遞updateNAvigation標題(在MWPhotoBrowser.m兩個功能)
+0

是的,我做到了,它工作 –