【问题标题】:Display view controller's view using custom animation iOS使用自定义动画 iOS 显示视图控制器的视图
【发布时间】:2010-07-01 10:56:50
【问题描述】:

我有一个按钮,按下时会向用户显示一个视图控制器。我目前使用这样的方法来做到这一点:

ProjectViewController *myProj = [[ProjectViewController alloc] init];
myProj.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
myProj.modalPresentationStyle = UIModalPresentationFullScreen;

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:myProj];
[self presentModalViewController:navController animated:YES];

[myProj release];
[navController release];

我想将这个新视图作为一个从屏幕中间开始增长的矩形呈现给用户。这样做的最佳方法是什么? 干杯

【问题讨论】:

    标签: iphone ipad ios


    【解决方案1】:

    尝试无证过渡风格zoomyIn/zoomyOut

    如果这些不是您要查找的,请将视图的框架设置为宽度/高度为 0 的视图的中心,并将其转换为最终大小和位置。未经测试的示例代码:

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.7];
    yourview.frame = finalFrame;
    [UIView commitAnimations];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多