翻转视图错误 - 访问未知的getter方法

时间:2010-12-02 08:16:09

标签: iphone

我有一个名为NView的视图,我在其中点击了一个设计按钮,我想在flipview中看到另一个视图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];

1 个答案:

答案 0 :(得分:0)

这可能是因为您没有使用容器视图作为转换视图。请参阅setAnimationTransition:forView:cache:

上的文档
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”bundle:nil];

vc.delegate = self;

//魔术声明。这将从右向左翻转。 //当你解雇ModalViewController时,显示模态视图控制器 //它将从左向右翻转。简单而优雅。

vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizo​​ntal;

[self presentModalViewController:vc animated:YES];

[vc release];

相关问题