我使用核心图创建了一个图表。图表完美地显示在屏幕上。我有一个全屏按钮点击它,popOver在更大的框架中显示图形......问题是当我调整图形大小时它不会调整大小..
如果我关闭弹出框,我仍然可以在屏幕上看到一个大字符。这不会一直发生。
在我的 .h 文件中
CPGraphHostingView *scatterPlotView;
CPXYGraph *graph, *barChart;
在我的 .m 文件中
我已经创建了图表,现在在全屏按钮上单击。
-(void)fullviewpressed:(id)sender
{
UIViewController* popoverContent = [[UIViewController alloc]
init];
UIView* popoverView = [[UIView alloc]
initWithFrame:CGRectMake(0, 212, 1024, 480)];
if(!UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
popoverView.frame = CGRectMake(0, 212, 768, 700);
popoverView.backgroundColor = [UIColor blackColor];
popoverContent.view = popoverView;
//resize the popover view shown
//in the current view to the view's size
popoverContent.contentSizeForViewInPopover = CGSizeMake(980, 460);
if(!UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
popoverContent.contentSizeForViewInPopover = CGSizeMake(768-40, 660);
//create a popover controller
UIPopoverController * popoverController21 = [[UIPopoverController alloc]initWithContentViewController:popoverContent];
self.popoverController = popoverController21;
[popoverController21 release];
self.popoverController.delegate = self;
CGRect btnRct = fullViewBtn.frame;
btnRct.origin.y+=20;
//present the popover view non-modal with a
//refrence to the button pressed within the current view
[self.popoverController presentPopoverFromRect:btnRct
inView:self.view
permittedArrowDirections: UIPopoverArrowDirectionUp
animated:YES];
if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
scatterPlotView.frame = CGRectMake(5, 10, 980, 460);
else
scatterPlotView.frame = CGRectMake(5, 10, 768-40, 660);
[popoverView addSubview:scatterPlotView];
[touchView removeFromSuperview];
touchView.frame =scatterPlotView.frame;
[popoverView addSubview:touchView];
//release the popover content
[popoverView release];
[popoverContent release];
}
}
这里的 touchView 是 UIView 的对象,用于在用户点击图表时添加注释。
简而言之,我只是在改变我的框架CPGraphHostingView
。但为什么有时它不调整大小。