Search code examples
iphonexcodeios5subclassing

Modifying MWPhotoBrowser in iPhone


Hi I am have added the MWPhotoBrowser in my iPhone application it works great but now i need to add a little more functionality to my photo gallery.

basically what to do a couple things:

  • add a button to the navigation bar
  • decrease the space between two images.

However I don't know how to approach this problem.. should I subclass the Photo Browser or should I make changes in the Photo Browser's source code.

P.S. i tried to modify the code directly in MWPhotoBrowser.h file which didn't work. No changes were made. I'm super new to iPhone programming so i don't have much idea what is going on. Any help would be greatly appreciated. I know its a noobish question so please go easy on down votes :)


Solution

  • In the MWPhotoBrowser.m file find the setNavBarAppearance method and add this

    UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
    target:self action:@selector(someAction)]; // This can be changed to your liking
    
    self.navigationItem.rightBarButtonItem = rightButton;
    [rightButton release];