我有一個UIViewContoller與一些容器(子)UIiewsController。主要的UIViewController(MVC)包含:如何將觸摸事件傳遞給parentViewController?
- 1)佔據MVC的整個視圖甲UICollectionView(它是上述mvc.view但低於所有其他控件)。
- 2.),其顯示搜索選項(s1vc)
- 3.)另一個類似於#2(s2vc)
- 4.)另一個類似於#2(s3vc)
一個UIViewController
我已經爲mvc添加了手勢識別器,以便用戶可以通過將它們從屏幕上滑開來隱藏/顯示每個子視圖控制器。
問題是,當用戶從屏幕上滑動任何svcs時,它們都無法滾動mvc的collectionView。
這是怎麼了隱藏/顯示SVCS:
-(void)swipeLeftGestureHandler:(UIGestureRecognizer*)gestureRecognizer{
SMLOG(@"Swiped Left");
if([SMUser activeUser] == nil) return;
if([self gestureHorizontalScreenSide:gestureRecognizer] == kHorizontalScreenSideLeft){
[self hideFacets];
}
else{
[self showAccordion];
}
}
-(void)swipeRightGestureHandler:(UIGestureRecognizer*)gestureRecognizer{
SMLOG(@"Swiped Right");
if([SMUser activeUser] == nil) return;
if([self gestureHorizontalScreenSide:gestureRecognizer] == kHorizontalScreenSideLeft){
[self showFacets];
}
else{
[self hideAccordion];
}
}
-(void)hideFacets{
if(self.facetVisible == NO) return;
[UIView animateWithDuration:0.25
animations:^{
CGRect newFrame = self.facetViewController.view.frame;
newFrame.origin = CGPointMake(newFrame.origin.x - newFrame.size.width, newFrame.origin.y);
self.facetViewController.view.frame = newFrame;
self.facetVisible = NO;
}
completion:^(BOOL finished){
self.facetViewController.view.hidden = YES;
self.facetViewController.view.userInteractionEnabled = NO;
}];
}
-(void)showFacets{
if([SMUser activeUser] == nil) return;
if(self.facetVisible == YES) return;
self.facetViewController.view.userInteractionEnabled = YES;
[UIView animateWithDuration:0.25
animations:^{
self.facetViewController.view.hidden = NO;
CGRect newFrame = self.facetViewController.view.frame;
newFrame.origin = CGPointMake(newFrame.origin.x + newFrame.size.width, newFrame.origin.y);
self.facetViewController.view.frame = newFrame;
self.facetVisible = YES;
}
completion:^(BOOL finished){
}];
}
正如你可以看到我在撥動svc.view.hidden屬性,然後我也嘗試觸發日svc.userInteractionEnabled.property但沒有運氣。仍然無法通過滑動切面視圖控制器所在的位置來滑動收集視圖。
任何想法?