core-plot和navigationController

时间:2010-11-15 16:41:04

标签: uinavigationcontroller core-plot

我正在使用核心情节sdk并尝试绘制条形图。

我有从UINavigationController扩展的RootViewController,我添加了我的viewController,它渲染了barChart,这里是代码

RootViewController.m

- (void)viewDidLoad {
   [super viewDidLoad];

   barChartViewController = [[BarChartViewController alloc]init];
   [self pushViewController:barChartViewController animated:NO];
}

BarChartViewController.m

- (void)viewDidLoad {
   [super viewDidLoad];

   self.title =@"BarChart";
   self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.4 green: 0.8 blue:0 alpha:1];

   self.navigationItem.title = @"BarChart";
    // and then creating the barchart and rendering it, which works fine.
}

这里没有出现navigationBar,因此是navigationBar的标题。 然后是来自BarChartViewController.m的以下代码

-(void)barPlot:(CPBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index{
   NSLog(@"barWasSelectedAtRecordIndex %d", index);
   DetailViewController *detailViewController =  
       [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:
          [NSBundle mainBundle]];

   [self.navigationController pushViewController: detailViewController animated:YES];
}

所以在上面的代码中我想要做的是,一旦用户从barChart中选择一个栏(正确显示),上面的方法被调用,我确实在控制台上看到日志消息正在显示告诉选择了哪个barChart,但是控制器没有使用我在这里推送的DetailViewController。

因为你可以看到我面临着代码的两个问题,导航栏没有出现,而另一个我无法将新的viewController推送到navigationController。我猜测核心情节和导航控制器存在一些问题。

请帮忙。

谢谢, 约杰什

0 个答案:

没有答案