2011年6月21日 星期二

cocos2D 存取rootViewController

使用cocos2D 0.99.5 版

要存取RootViewController的方法:

1.
AppDelegate.h 設定 
@property (nonatomic, retain) RootViewController *viewController;
AppDelegate.m 設定
@synthesize viewController;


2.要存取RootViewController的地方要
#import "AppDelegate.h"
#import "RootViewController.h"



之後用
RootViewController *rootViewCtr =  ((AppDelegate*)([UIApplication sharedApplication].delegate)).viewController;
取得RootViewController進行操作.

沒有留言:

張貼留言