我有一个包含三个容器的UIView
Container A - contains a UITableView
Container B - contains Container C and Container O
Container C - contains a UITableView
* - touch event
@ - touch event
----------------------
| | |
| ---*| B |
| --- | |
| -A- | ----------- |
| --- ||@----C---- | |
| | ----------- |
----------------------
一个事件发生了,我改变了容器B的框架(并显示了一个标记为O的视图在B的右侧,这不重要)。现在容器B与容器A重叠。
O - Other view (unimportant)
$ - original location of touch @
----------------------
| | | |
| --|* B | |
| --| | |
| -A|------------ |O|
| --||@-$--C----| | |
| |------------ | |
----------------------
但是现在,当我尝试通过触摸行的左边缘(@)选择容器C的UITableView中的一行时,触摸被Container A的UITableView注册。或者即使我在表格上面的视图上触摸(*),也会选择A中相应的行。
我可以通过更改Container A的UITableView的宽度来解决部分问题。但是,如果我触摸表C(@),则不会选择C的行。就像它认为表C的开头在旧位置($)一样。
那么我该怎么做才能在新的@位置点击时选择正确的C中的行呢?
=======
编辑带有一些代码:
这是我在Container B中执行的代码。它是B框架的非常简单的动画。self.view是Container B的UIView。
所有视图都通过Storyboard显示在屏幕上(“其他”容器被隐藏)。其他容器是B的子视图。
// this code basically aligns the "other" container to the right/"offscreen" of
// Container B. Yes extending beyond the frame of B, but this part works fine
CGRect otherContainerFrame = self.otherContainerView.frame;
otherContainerFrame.origin.x = CGRectGetMaxX(self.view.frame);
[self.otherContainerView setFrame:otherContainerFrame];
[self.otherContainerView setHidden:NO];
// I'm going move Container B by the width of the "other" view
float offset = CGRectGetWidth(self.otherContainerView.frame);
CGRect frame = self.view.frame;
frame.origin.x -= offset;
[UIView animateWithDuration:.35
animations:^{
[self.view setFrame:frame];
}
];
请告诉我您想看到的其他代码。