CorePlot(それを設定しようとしている時間のカップルの後に:P)での作業は初めて私の見解で削除 - テーブルビュー見えない
、私はテーブルビューを持っています。特定のIBActionが呼び出されるとき、私はテーブルビューの代わりに別のビュー(グラフ)を表示したいと思う。
私のアプローチは、テーブルビューに同じサイズのサブビューを追加することでした。グラフを表示するのにうまくいきますが、グラフビューを[テーブルのサブビュー]から削除すると、テーブルビューは再表示されません。
注:第1回スクリーンショット
-(IBAction)displayDayBalanceGraph:(id)sender{
if (hasSubView) {
[[expenseTable subviews] makeObjectsPerformSelector: @selector(removeFromSuperview)];
NSLog(@"%@",expenseTable.subviews);
}
else{
[self initializeMonthArray];
CPTGraphHostingView *host = [self buildGraphView];
[expenseTable addSubview:host];
CPTXYGraph *graph = [[CPTXYGraph alloc ]initWithFrame:host.frame];
host.hostedGraph = graph;
CPTScatterPlot *plot = [[CPTScatterPlot alloc]init ];
plot.dataSource = self;
[graph addPlot:plot];
[expenseTable reloadData];
hasSubView = !hasSubView;
}
}
-(CPTGraphHostingView *)buildGraphView{
CPTGraphHostingView *view = [[CPTGraphHostingView alloc]initWithFrame:CGRectMake(0, 0, 312, 260)];
[view setBackgroundColor:[self grayColor]];
return view;
}
expenseTable: my tableView
hasSubView: (BOOL) that indicates if a graph is shown right now or not
コード:テーブルビューが表示さ
第二スクリーンショット:GraphViewを表示 追記:これはsampleplotです=)
第三スクリーンショット:GraphViewは
を退け、私は逃したものを誰のアイデアを持っていますか?
- すべてのセルがサブビューであるため、私はちょうど想像したすべてを削除する必要があります。だから私は新しいサブビューが持っているインデックスを知る必要がありますか?何か案は? –
GraphViewをどのように解除しますか? –
上記のコードを見てください: '[[expenseTable subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];' –