TabBar支持Three20 iPhone照片库

TabBar支持Three20 iPhone照片库,iphone,three20,tabbar,photo-gallery,Iphone,Three20,Tabbar,Photo Gallery,我浏览了教程,为iPhone创建了一个照片库。现在我想把它添加到我的TabBar项目中。我已经听说Three20不支持XIB,所以我将整个选项卡栏设置更改为编程方式。我想我离最终解决方案不远了 我可以在一个选项卡中使用照片库,但没有任何功能(单击打开的图片-->等)。页面顶部没有引导您进入详细图像页面的导航。当我将其从应用程序委托中的didFinishLaunchingWithOptions方法中删除时,我遇到了这个问题: // Override point for customization

我浏览了教程,为iPhone创建了一个照片库。现在我想把它添加到我的TabBar项目中。我已经听说Three20不支持XIB,所以我将整个选项卡栏设置更改为编程方式。我想我离最终解决方案不远了

我可以在一个选项卡中使用照片库,但没有任何功能(单击打开的图片-->等)。页面顶部没有引导您进入详细图像页面的导航。当我将其从应用程序委托中的didFinishLaunchingWithOptions方法中删除时,我遇到了这个问题:

// Override point for customization after application launch
TTNavigator* navigator = [TTNavigator navigator];
TTURLMap* map = navigator.URLMap;
[map from:@"demo://album" toViewController:  [AlbumController class]];

[navigator openURLAction:[TTURLAction actionWithURLPath:@"demo://album"]];
return YES;
我必须删除它,因为否则整个选项卡栏不会显示。照片库使用整个屏幕。我不确定它是否只是没有显示,或没有加载。我还尝试:

tabbar.hidesBottomBarWhenPushed = NO;
但这根本不起作用。我尝试将TTNavigator代码添加到AlbumController本身的loadView()、viewDidLoad()和init(),但没有结果。有人知道我必须把它放在哪里才能让它工作吗

我的相册控制器。h:

#import <Foundation/Foundation.h>
#import <Three20/Three20.h>

@interface AlbumController : TTThumbsViewController {
    // images
    NSMutableArray *images;

    // parser
    NSXMLParser * rssParser;
    NSMutableArray * stories;
    NSMutableDictionary * item;
    NSString * currentElement;
    NSMutableString * currentImage;
    NSMutableString * currentCaption;
}

@property (nonatomic, retain) NSMutableArray *images;

@end
#import <Foundation/Foundation.h>
#import <Three20/Three20.h>

@interface AlbumController : TTThumbsViewController {

}

@property (nonatomic, retain) NSMutableArray *images;

@end
谢谢大家,干杯,再见

tBarController = [[UITabBarController alloc] init];
 actionController = [[ActionController alloc] initWithNibName:nil bundle:nil];
    // Override point for customization after application launch.
    TTNavigator* navigator = [TTNavigator navigator];
 TTURLMap* map = navigator.URLMap;
 [map from:@"demo://album" toViewController:tBarController];
 [tBarController setViewControllers:
     [NSArray arrayWithObjects:actionController,nil]];
 [navigator openURLAction:[TTURLAction actionWithURLPath:@"demo://album"]];

 [self.window addSubview:tBarController.view];
 [self.window makeKeyAndVisible];

    return YES;

好了,伙计们,在Bryan的帮助下,我能够在一个标签栏应用程序中运行照片库。我看到很多人都在寻找这个解决方案,所以我尽量解释清楚

似乎不可能在Interface Builder中使用Three20,因此您必须手动设置选项卡栏应用程序。这是我的320PhotoGalleryAppDelegate.h:

#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import "AlbumController.h"
#import "SecondViewController.h"
#import "FirstViewController.h"

@class TabBarAppViewController;
@class AlbumController;
@class SecondViewController;
@class FirstViewController;

@interface Three20PhotoGalleryAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;
    UITabBarController *tabBarController;
    AlbumController *albumController;
    FirstViewController *firstViewController;
    SecondViewController *secondViewController;

@private
    NSManagedObjectContext *managedObjectContext_;
    NSManagedObjectModel *managedObjectModel_;
    NSPersistentStoreCoordinator *persistentStoreCoordinator_;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) UITabBarController *tabBarController;
@property (nonatomic, retain) AlbumController *albumController;
@property (nonatomic, retain) SecondViewController *secondViewController;
@property (nonatomic, retain) FirstViewController *firstViewController;

@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;
@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (NSURL *)applicationDocumentsDirectory;
- (void)saveContext;

@end
正如上面问题描述中所述,我的照片库始终使用全屏。这是不好的,因为你不能再使用你的标签栏图标了。为此,您必须添加

self.hidesBottomBarWhenPushed=NO;
类似于上面AlbumController init方法中提到的init()方法

苏欧,差不多就是这样。我真的希望有人能重复使用我的解决方案。再次感谢布莱恩

干杯,伙计们, 杜诺


PS:我已经在github上创建了一个项目。您可以下载示例应用程序。

您可以使用TTNavigatorDemo示例学习如何将其与选项卡栏控制器一起使用。

嗨,Bryan,非常感谢您的回答。我试过你的代码,但我只得到一个在页面底部有一个黑色条的白色屏幕。我试图修改代码,但无法解决它。还有其他想法吗(我在推特上看到你的推特:)。您说过AlbumController/ActionController需要是UITableViewController。我正在使用上述教程中AlbumController的代码。本教程使用TTThumbsViewController,因为我想在照片应用程序中显示这些缩略图。在选项卡图标下显示“正常”视图一点问题都没有……就我现在所知,我认为AlbumController的调用是正确的,但我认为它隐藏了页面底部的选项卡栏!我试过[self.hidesBottomBarWhenPushed=NO];和[self.wantsFullScreenLayout=NO];但是没有成功!
#import <Foundation/Foundation.h>
#import <Three20/Three20.h>

@interface AlbumController : TTThumbsViewController {

}

@property (nonatomic, retain) NSMutableArray *images;

@end
#import "AlbumController.h"
#import "PhotoSource.h"
#import "Photo.h"

@implementation AlbumController
@synthesize images;

- (id)init
{
    if (self = [super init]) 
    {
        // Initialization code
        self.title = @"Photo Gallery";
        self.hidesBottomBarWhenPushed=NO;
    }
    return self;
}


- (void)viewDidLoad {

    [self createPhotos]; // method to set up the photos array
    self.photoSource = [[PhotoSource alloc]
                        initWithType:PhotoSourceNormal
                        title:@"All in Vain"
                        photos:images
                        photos2:nil];
}

-(void)createPhotos {
    // your independent implementation
}

@end
self.hidesBottomBarWhenPushed=NO;