2012-06-10 52 views
2

導航欄可以響應ZUUIRevealController中的平移手勢。但我想使frontViewController的整個屏幕響應平移手勢就像路徑2,所以我寫這樣的代碼:如何在ZUUIRevealController中製作tableview響應平移手勢

UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.navigationController.parentViewController action:@selector(revealGesture:)]; 

[self.view addGestureRecognizer:recognizer]; 

它工作正常,除了在的UITableViewController。當我把它放在UITableViewController的viewDidLoad方法中時,表格不能響應任何其他的平移手勢,所以它不能滾動。

我該如何讓它像Path2一樣工作:水平平移是爲了揭示,而垂直是像普通表視圖一樣工作?

+0

採取這裏看看http://stackoverflow.com/questions/2627934/simultaneous-gesture-recognizers-in-iphone- sdk/2628777#2628777 – mja

回答

6

有一個簡單的解決方案:

在frontViewController:

- (void)viewDidLoad 
{ 
... 

    UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.navigationController.parentViewController action:@selector(revealGesture:)]; 

    recognizer.delegate = self; 

... 
} 

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 
{ 
    return TRUE; 
} 
+0

謝謝@gyro!它幫助了我。 – vilelam