【发布时间】:2012-01-13 16:09:40
【问题描述】:
我在 self.view 中添加了一些按钮。当用户单击一个按钮时,我将加载另一个视图(子视图)。我正在加载子视图的代码如下所示
subView = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.scrollView.contentSize.width, self.scrollView.contentSize.height)];
subView.tag=1;
// and then i add various other components to it
[self.view addSubview:subView]; // and finally add it to the view
当用户触摸这个视图时,我检测到它并移除视图(我已经完成了检测部分)。
这就是我删除视图的方式
UIView *v = [self.subView viewWithTag:1];
v.hidden = YES;
[v endEditing:YES];
[v removeFromSuperview];
视图消失,但我无法单击按钮或 self.view 上的任何内容。当我将鼠标光标放在按钮上一段时间时,我可以单击它,否则我不能。我该如何解决这个问题?
【问题讨论】:
标签: iphone objective-c