I need a gallery in my application and I found this tutorial on how to implement the Three20 into my application: http://www.raywenderlich.com/1430/how-to-use-the-three20-photo-viewer.
I’ve a storyboard where the root is a Tab Bar Controller. This root controller has a relation with a View Controller with the class PhotoViewController from the above tutorial.
The last step in the tutorial is to add code to the AppDelegate, but in my case I added this code to the PhotoViewController:
#import "PhotoViewController.h"
#import "PhotoSet.h"
@implementation PhotoViewController
@synthesize photoSet = _photoSet;
- (void) viewDidLoad {
[[TTURLRequestQueue mainQueue] setMaxContentLength:0];
TTNavigator *navigator = [TTNavigator navigator];
UIWindow *window = [UIApplication sharedApplication].keyWindow;
navigator.window = window;
TTURLMap *map = navigator.URLMap;
[map from:@"tt://appPhotos" toSharedViewController:[PhotoViewController class]];
[navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://appPhotos"]];
self.photoSource = [PhotoSet samplePhotoSet];
}
- (void) dealloc {
self.photoSet = nil;
}
@end
Here is a image of the result after tabbing the “Gallery” tab in the root tab controller:
Here is a image when I scroll in the view:
This is almost fine, but I have some issues:
- When I tab the Gallery and the above view appear, there is no way back to the root tab controller. How can I add a back button?
- When I swipe in the gallery, the text “Error” is displayed for a while until the image is fully loaded. Why?
- When I tab “See All” it shows an list of all images. How can I change the background-color for the navigation bar in the top?
I think that MWPhotoBrowser has a nicer interface than EGOPhotoViewer (feels closer to the native Photos app).