【发布时间】:2011-06-07 09:41:55
【问题描述】:
在我看来,我有一个 scrollView 作为子视图。 scrollView 有另一个称为 PDFView 的子视图。它用于显示 PDF 页面。
此视图有 2 个子视图。 drawImage 是从磁盘加载的整个 PDF 视图上方的图像。
而paintView 是完成所有绘画和标记的第二个子视图。
但我只想在按下paint Button时添加paintView。
这可行,但是当我再次按下它以停止绘画模式并从超级视图中删除视图时,整个屏幕变白。
我怎样才能绕过它?
- (id)init
{
...
[self.view addSubview:theScrollView];
[theScrollView addSubview:thePDFView];
drawImage = [UIImage imageWithData:retrievedData];
[thePDFView addSubview:drawImage];
paintView = [[PaintViewController alloc] initWithImage:drawImage andPath:pageString];
}
- (void) togglePainting:(NSNotification *)notif {
if (!painting) {
theScrollView.scrollEnabled = false;
[thePDFView addSubview:paintView.view];
}
else {
theScrollView.scrollEnabled = true;
[thePDFView removeFromSuperview];
}
painting = !painting;
}
【问题讨论】:
标签: iphone xcode uiview uiviewcontroller subview