我有 iphone 应用程序,在其中我将 subView 添加到窗口它工作正常,但我希望当我按下关闭按钮时它应该隐藏 subView 这里是我为创建 subView 所做的代码
UIView*subView=[[UIView alloc]initWithFrame:CGRectMake(0,0, 1024,768)];
subView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bgPopupback.png"]];
UIWindow* window = [UIApplication sharedApplication].keyWindow;
if (!window)
window = [[UIApplication sharedApplication].windows objectAtIndex:0];
[[[window subviews] objectAtIndex:0] addSubview:subView];
关闭按钮操作
-(void)closeButtonAction{
NSLog(@"CLicked on this button");
[subView removeFromSuperview] ;
self.tableView.userInteractionEnabled=TRUE;
}