iOS 8 - Modal in Popover

520 views Asked by At

I have a popover with TabBarController in it. In one tab there is a TableViewController with a list of names. And there is a plus button, that has a modal segue to AddCharacterVC for adding new names. In iOS 7 I do it like this:

AddCharacterViewController *acvc = (AddCharacterViewController *)segue.destinationViewController;
acvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
acvc.modalPresentationStyle = UIModalPresentationCurrentContext;// so it does not take full screen in popover

And in AddCharacterVC I set content size like this:

- (void)viewWillAppear:(BOOL)animated {

CGSize size = CGSizeMake(320, 480); // size of view in popover
if (IDIOM == IPAD && [self respondsToSelector:@selector(preferredContentSize)]){
    self.preferredContentSize = size;
}

And it works perfectly.

However, in iOS 8 modal view does not cover the whole popover, leaving TabBar visible. The user can tap on it or not, anyway modal view won't unwind properly.

I've tried:

  • setting acvc.modalPresentationStyle to UIModalPresentationOverCurrentContext
  • tried to set TabBar hidden
  • checked in storyboard that edges of TableVC extend under Bottom Bar and Bottom Bar in Modal View (AddCharacterVC) is set to none

All with no results.

Now the only thing I can think of is to try making modalPresentationStyleCustom and use UIPresentationController (I'm trying to do it now, but I haven't done it before). Am I missing something? Could there be other way to do it? Sorry, I cannot post images here yet. Many thanks in advance!

1

There are 1 answers

0
Spot On BEST ANSWER

Ok, so I've set the modalPresentationStile to UIModalPresentationCustom, and used UIPresentationController - I've just copied code from WWDC-14's LookInside project and modified it a bit. I'm not sure if it was the best solution, but it worked in my case.