【问题标题】:iOS Modal View Controller PageCurl Animation not showingiOS 模态视图控制器 PageCurl 动画未显示
【发布时间】:2012-02-07 07:51:11
【问题描述】:

我有一个ParentViewController,它和它的SiblingsViewControllers 一起在UIScrollView 中,就像下面的树一样。

  • RootViewController
    • UIScrollView
      • HomeViewController
      • ParentViewController
        • FormNotesViewController - 使用 PageCurl 呈现的模式视图
      • FooViewController
      • BarViewController

ModalViewController 由 ParentViewController 在 IBAction 时提供,具有以下功能。

- (IBAction)onNoteOpen:(id)sender {
FormNotesViewController *notesView = [[FormNotesViewController alloc] initWithNibName:@"FormNotesViewController" bundle:nil];

//OPTION #1
notesView.modalTransitionStyle = UIModalTransitionStylePartialCurl;
notesView.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:notesView animated:YES];


//OPTION #2    
//    [UIView beginAnimations:@"PartialPageCurlEffect" context:nil];
//    [UIView setAnimationDuration:1.0];
//    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp
//                           forView:notesView.view cache:NO];
//    [self.view addSubview:notesView.view];
//    [UIView commitAnimations];
}

我已经尝试了选项#1 和#2。尽管它们都显示了notesView,但应用程序无法显示转换。

我不知道为什么。

会不会是因为UIScrollView?难道是我错过了什么?有什么建议可以调试吗?

【问题讨论】:

  • 您检查过 FormNotesViewControllers 视图上的 frame 属性吗?也许你必须等到在你的笔记控制器中调用 viewDidLoad。

标签: ios ios5 modalviewcontroller presentmodalviewcontroller


【解决方案1】:

选项 1:

FormNotesViewController *notesView = [[FormNotesViewController alloc] initWithNibName:@"FormNotesViewController" bundle:nil];

notesView.modalTransitionStyle = UIModalTransitionStylePartialCurl;

[self presentModalViewController:notesView animated:YES];

选项 2:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:notesView.view cache:YES];
[self.view addSubview:notesView.view];
[UIView commitAnimations];

【讨论】:

  • 我不得不使用不同的视图结构来解决这个问题。显然在UIScrollView 中有很多视图并从UIScrollView 的子视图之一调用FormNotesViewController 与我面临的问题有关。我使用不同的结构代替视图组织。我很害怕,因为我不再参与该项目,所以我无法尝试您提供的解决方案。不过还是谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-03-05
  • 2011-07-13
  • 2011-10-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多