我有一个带有一堆行的 UITableView。当用户点击某一行时,表格顶部会出现一个自定义弹出窗口(即自定义 UIView):
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
PopUp *myPopUp = [[PopUp alloc] initWithFrame:CGRectMake(0, 0, 320, 568)];
[self.view addSubview:myPopUp];
}
我正在从笔尖加载我的自定义 UIView PopUp:
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self loadNib];
}
return self;
}
- (void) loadNib
{
NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"PopUp" owner:self options:nil];
UIView *mainView = [subviewArray objectAtIndex:0];
[self addSubview:mainView];
}
在 PopUp 中,按下时有一个按钮会导致 PopUp 关闭:
- (IBAction)closePopUp:(id)sender
{
[self removeFromSuperview];
}
按下按钮时弹出窗口消失。但是,下面的 UITableView 不能再进行交互(即用户不能滚动表格,不能点击另一行等)。我希望 PopUp 消失并让表格再次完全交互。谁能解释为什么会发生这种情况以及我如何解决这个问题?谢谢!
用截图编辑
UITableView with a row of data: http://imgur.com/PlIufHI,xGKxUul,qkt27oZ#0
When a row is selected, myPopUp appears on top: http://imgur.com/PlIufHI,xGKxUul,qkt27oZ#1
When the "x" custom button is pressed, it calls closePopUp, which removes myPopUp from the superview: http://imgur.com/PlIufHI,xGKxUul,qkt27oZ#2
User is unable to interact with the table now. User cannot select a row, scroll through the table, etc.