I am trying to build a small app. It's a tabbed app with 3 tabs: photos, videos, documents Each tab displays a tableview to select wich gallery, video, document is to be shown; Videos work fine.
I'm having trouble with photo galleries. I use Fgallery which is working fine from the sample: Fgallery git
.h
#import <UIKit/UIKit.h>
#import "FGalleryViewController.h"
@interface FirstViewController : UIViewController <FGalleryViewControllerDelegate, UITableViewDelegate, UITableViewDataSource> {
NSArray *localCaptions;
NSArray *localImages;
NSArray *networkCaptions;
NSArray *networkImages;
FGalleryViewController *localGallery;
FGalleryViewController *networkGallery;
}
@property (nonatomic, strong) UITableView *myTableView;
@end
.m
#import "FirstViewController.h"
@implementation FirstViewController
@synthesize myTableView;
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect tableViewRect = self.view.bounds;
UITableView *tableView = [[UITableView alloc]
initWithFrame:tableViewRect
style:UITableViewStylePlain];
self.myTableView = tableView;
self.myTableView.autoresizingMask =
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth;
[self.view addSubview:self.myTableView];
self.myTableView.dataSource = self;
self.myTableView.delegate = self;
}
and
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog( @"Choix Table");
if( indexPath.row == 0 ) {
NSLog( @"selection 1");
localGallery = [[FGalleryViewController alloc] initWithPhotoSource:self];
[self.navigationController pushViewController:localGallery animated:YES];
}
else if( indexPath.row == 1 ) {
networkGallery = [[FGalleryViewController alloc] initWithPhotoSource:self];
[self.navigationController pushViewController:networkGallery animated:YES];
...
}
I really don't know how to display the gallery. The didSelectRowAtIndexPath
is the one from fgallery, I tried to modify it to show the viewm but I'm new to Objective-C and I'm stuck.
Any help or guideline will be appreciated.
Thanks
In FGalleryViewController.m, I added btn2 to the navigation controller
And voilà