Ios 在选项卡式应用程序中从 UITableView 启动 Fgallery
我正在尝试构建一个小型应用程序。这是一个选项卡式应用程序,有 3 个选项卡:照片、视频、文档 每个选项卡都会显示一个表格视图,以选择要显示的图库、视频、文档;视频效果很好。
我在使用照片库时遇到了麻烦。我使用 Fgallery ,它在示例中运行良好: 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;
}
我
#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];
...
}
真的不知道如何显示图库。 didSelectRowAtIndexPath
是来自 fgallery 的,我尝试修改它以显示视图,但我是 Objective-C 的新手,我陷入了困境。
任何帮助或指导将不胜感激。
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我添加了
视图现在显示正常,但我缺少后退按钮
I added
View shows ok now but I am missing the back button
在 FGalleryViewController.m 中,我将 btn2 添加到导航控制器
,瞧
In FGalleryViewController.m, I added btn2 to the navigation controller
And voilà