5

我的应用完全忽略了 UIModalPresentationFormSheet 和 UIModalTransitionStyleCrossDissolve。它总是弹出全屏并带有默认转换。

它在我的真实应用程序上完成。然后我做了一个空白测试应用程序,它做同样的事情。

这很简单:我的 AppDelegate 加载 KBViewController 作为根视图。KBViewController 尝试呈现一个空白视图控制器 (KBModalViewController)。KBModalViewController.xib 中的视图设置为“FormSheet”大小

我的视图控制器:

@implementation KBViewController


-(void)viewDidAppear:(BOOL)animated{
    [self setModalPresentationStyle:UIModalPresentationFormSheet];
    [self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    KBModalViewController *m = [[KBModalViewController alloc] initWithNibName:nil bundle:nil];
    [self presentViewController:m animated:YES completion:nil];

    //Also tried the depreciated presentModalViewController, same result
    //[self presentModalViewController:m animated:YES];
}

我正在使用 Xcode 4.61。我已经编译到 ipad 5.1、ipad 6.1 和 6.1 上的真正 ipad 2。都一样。

4

2 回答 2

7

尝试..

@implementation KBViewController


    -(void)viewDidAppear:(BOOL)animated{

        KBModalViewController *m = [[KBModalViewController alloc] initWithNibName:nil bundle:nil];
        [m setModalPresentationStyle:UIModalPresentationFormSheet];
         [m setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
        [self presentViewController:m animated:YES completion:nil];

        //Also tried the depreciated presentModalViewController, same result
        //[self presentModalViewController:m animated:YES];
    }
于 2013-06-27T11:40:02.493 回答
1

试试这样 -

KBModalViewController *m = [[KBModalViewController alloc] initWithNibName:nil bundle:nil];
m.modalPresentationStyle = UIModalPresentationFormSheet;
m.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:m animated:YES];
[m release];
于 2013-06-27T11:43:20.553 回答