2014-04-05 69 views
1

我想實現ECSlidingViewController執行縮放效果。當使用underLeftViewControlleranchorTopViewToRightAnimated時,效果是完美無瑕的。但是,在特定情況下,我需要使用underRightViewControlleranchorTopViewToLeftAnimated。但是,當我這樣做時,在左側完美工作的相同視圖控制器在右側的行爲不可預測。觀點基本上在正確的地方結束,但他們根本沒有動畫。這是我創建和設置ECSlidingViewController代碼:使用ECSlidingViewController時,爲什麼underRightViewController不能正確動畫?

if (self.slidingViewController == nil) 
    { 
     self.fieldSearchController = [[FieldSearchTableViewController alloc] initWithNibName:@"FieldSearchTableViewController" bundle:nil]; 
     self.filterVC = [[FieldSearchFilterTableViewController alloc] initWithNibName:@"FieldSearchFilterTableViewController" bundle:nil]; 
     self.slidingViewController = [[ECSlidingViewController alloc] initWithTopViewController:self.fieldSearchController]; 
     //self.slidingViewController.underLeftViewController = self.filterVC; 
     self.slidingViewController.underRightViewController = self.filterVC; 
    } 

    if (self.slidingViewController.parentViewController == nil) 
    { 
     [self addChildViewController:self.slidingViewController]; 
     CGRect frame = self.view.bounds; 
     NSInteger topSize = self.navigationController.navigationBar.frame.size.height + [UIApplication sharedApplication].statusBarFrame.size.height; 
     frame.origin.y = topSize; 
     frame.size.height -= topSize; 
     self.slidingViewController.view.frame = frame; 
     [self.view addSubview:self.slidingViewController.view]; 
    } 

而且這裏是我使用的頂視圖的主要代碼:

//0 - Default 
    //1 - Fold 
    //2 - Zoom 
    //3 - Dynamic 
    NSDictionary *transitionData = self.transitions.all[0]; 
    id<ECSlidingViewControllerDelegate> transition = transitionData[@"transition"]; 
    if (transition == (id)[NSNull null]) { 
     super.slidingViewController.delegate = nil; 
    } else { 
     self.slidingViewController.delegate = transition; 
    } 

    NSString *transitionName = transitionData[@"name"]; 
    if ([transitionName isEqualToString:METransitionNameDynamic]) { 
     self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGestureCustom; 
     self.slidingViewController.customAnchoredGestures = @[self.dynamicTransitionPanGesture]; 
     [self.navigationController.view removeGestureRecognizer:self.slidingViewController.panGesture]; 
     [self.navigationController.view addGestureRecognizer:self.dynamicTransitionPanGesture]; 
    } else { 
     self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGesturePanning; 
     self.slidingViewController.customAnchoredGestures = @[]; 
     [self.navigationController.view removeGestureRecognizer:self.dynamicTransitionPanGesture]; 
     [self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture]; 
    } 

    [self.slidingViewController anchorTopViewToLeftAnimated:YES]; 

這還不是全部的代碼,但我認爲問題出現在這兩個區塊中的某一個區域。或者,也許,右邊的動畫就像我認爲它不應該那樣工作?我還沒有看到使用這種方法的其他示例,所以我可能需要對控件IDK進行更多的自定義。

感謝您對此提供的任何幫助。

回答