将viewcontroller(piechartController)初始化为viewcontroller(covVC)变量

时间:2010-09-27 12:57:27

标签: iphone ipad uiviewcontroller

我正在执行以下操作将viewcontroller(piechartController)初始化为viewcontroller(covVC)变量,如下所示......是否更改视图控制器变量?

  self.pie = [[ChatController alloc] initWithNibName:@"Chat" bundle:nil];
self.covVC = [[coverAssetController alloc] init];
self.covVC.pieObj = self.pie;

coverAssetController.h ------>

 @interface coverAssetController : UIViewController {


    ChatController *pieObj;
 }

1 个答案:

答案 0 :(得分:1)

您需要在coverAssetController中添加一个属性:

 @interface coverAssetController : UIViewController {

    PieChartController *pieObj;

 }
@property(nonatomic, assign) PieChartController *pieObj;

在你的实现中添加:

@synthesize pieObj;

无论如何,这样做是可以的^^ 但事实上,这取决于你想做什么等等。