user1560196
user1560196

Reputation: 178

IOS Ignoring ModalPresentationStyle and ModalTransitionStyle and presenting fullscreen

My App is completely ignoring UIModalPresentationFormSheet and UIModalTransitionStyleCrossDissolve. It is always popping up fullscreen and with the default transition.

It does it on my real app. I then made a blank test app, and it does the same thing.

It is quite simple: My AppDelegate loads KBViewController as the root view. KBViewController tries to present a blank view controller (KBModalViewController). The view in KBModalViewController.xib is set to the "FormSheet" Size

My View Controller:

@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];
}

I am using Xcode 4.61. I have compiled to ipad 5.1, ipad 6.1, and a real ipad 2 on 6.1. Same on all.

Upvotes: 5

Views: 4627

Answers (2)

iSmita
iSmita

Reputation: 1292

Try Like this -

KBModalViewController *m = [[KBModalViewController alloc] initWithNibName:nil bundle:nil];
m.modalPresentationStyle = UIModalPresentationFormSheet;
m.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:m animated:YES];
[m release];

Upvotes: 1

Sunny Shah
Sunny Shah

Reputation: 13020

Try..

@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];
    }

Upvotes: 7

Related Questions