2010-12-02 24 views
0

我有一個視圖叫做NView,我在其中有一個設計按鈕,點擊其中我想在翻轉視圖中看到另一個視圖DView,但它不起作用。以下是我的代碼。我叫accessing unknown getter method錯誤:翻轉查看錯誤 - 訪問未知的獲取方法

NSLog(@"yuppii"); 
[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.75]; 
[UIView setAnimationTransition:([NView superview] ? UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight) 
         forView: DView cache:YES]; 
+0

閱讀錯誤消息。如果仍不確定,請在此處顯示。 – Eiko 2010-12-02 08:22:38

回答

0

它,因爲你不使用的容器視圖作爲過渡觀點可能是。請參閱文檔上setAnimationTransition:forView:緩存:

If you want to change the appearance of a view during a transition—for example, flip from one view to another—then use a container view, an instance of UIView, as follows: 

    1. Begin an animation block. 
    2. Set the transition on the container view. 
    3. Remove the subview from the container view. 
    4. Add the new subview to the container view. 
    5. Commit the animation block. 

嘗試在showMoreInfo的動畫過渡視圖中使用self.view.superview:

的原因showLessInfo:方法的工作原理是你用的是容器視圖。

,或者使用這種方式,可以幫助ü......

CustomViewController * VC = [[CustomViewController的alloc] initWithNibName:@ 「CustomViewController」 束:無];

vc.delegate = self;

//神奇的陳述。這將從右向左翻轉。 //呈現模式視圖控制器,然後當您解除ModalViewController //它將從左向右轉換翻轉。簡單而優雅。

vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizo​​ntal;

[self presentModalViewController:vc animated:YES];

[vc release];