0

I am trying to display on the iPad a UIcontroller in my original viewcontorller, but smaller sized, so that the user is able to interact with it as well as with the contorller in the background. this was my aim but it is ok even if the user can't interact with the controller on the background, but it is essential to see the contorller in the background. I tried this code:

controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:controller animated:YES];


    controller.view.layer.cornerRadius = 10; // this value vary as per your desire
    controller.view.clipsToBounds = YES;

    controller.view.frame = CGRectMake(343, 163, 316, 546.5);

This displays the controller with the set frame, but in the background you can't see the other controller, but just black. Why?

Alessandro
  • 4,000
  • 12
  • 63
  • 131
  • Take a look at my answer on this [related question](http://stackoverflow.com/questions/14248954/keep-a-uiview-or-uiviewcontroller-on-top-of-all-others/14249744#14249744) which describes how to have two view controllers visible at the same time. – Jesse Rusak Jan 13 '13 at 20:18

1 Answers1

1

Definetely use this Presenting View Controllers from Other View Controllers and this About View Controllers

The section "Presentation Styles for Modal Views" says about your problem I think.

There are different presentation styles for controllers. You can set property - modalPresentationStyle to UIModalPresentationPageSheet or UIModalPresentationFormSheet that shows view controllers above other.

controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
controller.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:controller animated:YES];

Another way is using UIPopoverController. It designed for showing views that sized not all the screen view. But the touches on other view controller will hide it.

Yuri
  • 459
  • 5
  • 13
  • by using UIModalPresentationFormSheet I can see the background, but there is a fixed window in the middle of the screen – Alessandro Jan 13 '13 at 20:48
  • it works if I do: controller.view.superview.frame = CGRectMake(343, 163, 316, 546.5);, though I can't interact with the background controller – Alessandro Jan 13 '13 at 20:51