2011-02-02 90 views
0

当我的应用第一次启动时,它会显示一个登录Facebook的主页面。然后,它进入UITabBarController。我有我的应用程序委托,代码如下:将Facebook上的信息传递给UITabBarController

//this is the .h 
@interface NMeAppDelegate : NSObject <UIApplicationDelegate> { 
    UIWindow *window; 
    MainViewController *controller; 
    UITabBarController *tabBar; 
} 

@property (nonatomic, retain) IBOutlet UITabBarController *tabBar; 
@property (nonatomic, retain) MainViewController *controller; 
@property (nonatomic, retain) IBOutlet UIWindow *window; 

@end 

//this is the .m of the app delegate 
#import "NMeAppDelegate.h" 

@implementation NMeAppDelegate 

@synthesize window; 
@synthesize tabBar; 
@synthesize controller; 

#pragma mark - 
#pragma mark Application lifecycle 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

    // Override point for customization after application launch. 
    controller = [[MainViewController alloc] init]; 
    [window addSubview:tabBar.view]; 
    [window addSubview:controller.view]; 
    [window makeKeyAndVisible]; 

    return YES; 
} 

里面的MainViewController,其实我有一个的UserInfo对象,它拥有所有我需要的的UITabBarController的信息。问题是,在UITabViewController中获取此信息后,如何将此UserInfo传递给UITabBarController`或可能位于UITabBarController内部的ViewController,以便他们能够访问此UserInfo?这个怎么做?

我希望我的问题有道理。

+0

恐怕你所希望的没有成为现实:你的问题没有道理:)请清楚地说明你正在努力达到的目标以及正在发生的事情。 – 2011-02-02 23:19:56

回答

0

您需要有一个可用于选项卡栏控制器的UserInfo对象的实例。可能会在您转换到指定控制器时将其传递到您的UItabBarController /每个视图控制器中的UserInfo类型的实例变量。编辑:你真的应该把它传递给它所需要的视图控制器(因为它没有出现你有一个自定义的UITabBarController子类),或者你可以在你的应用程序委托中使用一个共享的UserInfo变量来保持随信息一起提供。

但正如评论者所说,这个问题根本不是很清楚,我完全可能会误解你想做的事情。

希望有所帮助。