1

I'm trying to implement MWPhotoBrowser in my project. I've added all the delegates, but it still will not display the photo.

Here's my didSelectRowAtIndexPath:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  [self performSegueWithIdentifier:@"MWPhotoBrowserSegue" sender:self] 
}

This is my segue method:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
   if ([segue identifier] isEqualToString:@"MWPhotoBorwserSegue"]) 
   {
       photoBrowser = [[MWPhotoBrowser alloc]initWithDelegate:self]; 
       UINavigationController * nc = [[UINavigationController alloc]initWithRootViewController:photoBrowser]; 

      nc.modalTransitionStyle = UIModalTransitionStyleCrossDisolve; 

      [photos addObject:[MWPhoto photoWithImage:[UIImage imageNamed:@"picasa.jpg"]]; 

      [photoBrowser setCurrentPhotoIndex:0]; 

      [self.navigationController presentViewController:nc animated:YES completion:nil]; 
   }
}

The #ofPhotosInBrowser:

-(NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser 
{
    return self.photos.count;
}

photoAtIndex:

- (MWPhoto *)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index {
if (index < self.photos.count)
    return [self.photos objectAtIndex:index];
return nil;
}

Here's what I get after the didSelectRowAtIndexPath: is called: enter image description here Edit for Solution:

MWPhotoBrowser will not display a photo unless you put self.title in the initWithStyle: method. I also forgot to add the viewWillDisappear and viewWillAppear

jsmos
  • 497
  • 2
  • 5
  • 15

2 Answers2

0

I think u need to call reload data on it. Check Mwphotobrowser.h for proper way to do it.

FrostyL
  • 811
  • 6
  • 9
0

try this [[NSOperationQueue mainQueue] addOperationWithBlock:^{ [self presentViewController:yourNewNavigationController animated:YES completion:nil]; }];

lhmsweet
  • 21
  • 1