2014-01-06 125 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

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