如何在CoreData中显示已保存的值?

时间:2016-01-28 07:41:15

标签: ios objective-c core-data

我有一个HomeViewController作为rootViewController。我在addButton中放置了barButtonItem。如果我点击addButton它会显示NewConnectionViewController。< / p>

HomeViewController.m

- (IBAction)onClickAddConnection:(id)sender 
{    
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
NewConnectionViewController * nvc = (NewConnectionViewController *)[sb instantiateViewControllerWithIdentifier:@"newConnectionIdentifier"];
[self.navigationController pushViewController:nvc animated:YES];
}

NewConnectionViewController我放置了一个connectionNoText。如果connectionNoText等于435.它应该显示连接详细信息的值(值在{{1}的对象中在connect中。}我必须使用HomeViewController中的ChartView显示连接详细信息值。我有一个名为HomeViewController的单独UIView类。

NewConnectionViewController.m

chartView

单击“保存”按钮时,我可以调用-(IBAction)Save:(id)sender { if ([stateText.text isEqualToString:@"Tamilnadu"]) { if ([connectionNoText.text isEqualToString:@"435"]) { NSLog(@"ConnectionNo correct==>>%@",connect); HomeViewController *homeViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"HomeViewidentifier"]; [self.navigationController pushViewController:homeViewController animated:YES]; } } } 。但如果我在homeViewController中单击chartView并且我写了435并且我单击了保存按钮意味着它应该显示ChartView的值为Down第一个视图......。每当我们点击保存按钮时,它应该添加chartView ..如果你对此段落感到困惑,没有什么只是“喜欢用ChartView添加值来在HomeViewController中呈现它,还必须使用tableView逐个添加“

1 个答案:

答案 0 :(得分:0)

你需要将rootviecontroller作为navigationcontroller来推送一个viewcontroller,否则self.navigationcontroller不存在引用