いくつかのコンテナー (子) UIiewsController を持つ UIViewContoller があります。メインの UIViewController (mvc) には以下が含まれます。
- 1.) mvc のビュー全体を占める UICollectionView (mvc.view の上にありますが、他のすべてのコントロールの下にあります)。
- 2.) 検索オプションを表示する UIViewController (s1vc)
- 3.) #2 (s2vc) に似た別のもの
- 4.) #2 に似た別のもの (s3vc)
ジェスチャ認識機能を mvc に追加して、ユーザーが子ビュー コントローラーを画面からスワイプして非表示/表示できるようにしました。
問題は、ユーザーがいずれかのサービスを画面からスワイプすると、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 も切り替えようとしましたが、うまくいきませんでした。ファセットビューコントローラーがあった/ある場所をスワイプしてコレクションビューをスワイプすることはできません。
何か案は?