UA-17470720-3

Jump to content


Photo
- - - - -

default instead of sectionActions.customPresentDetailModel


  • Please log in to reply
2 replies to this topic

#1 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 24 July 2015 - 03:20 PM

Hi all,

 

I'm using sectionActions.customPresentDetailModel to get more control of where the detailModel.viewController are presented in the UISplitViewController.

 

But how do I get the STV default behaviour when the section is adding a new object and indexPath.row is NSNotFound? Is there  a STV method I can call that will do that, ignoring my sectionActions.customPresentDetailModel?


Cheers,

Dave

www.dgapps.ie

#2 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 25 July 2015 - 01:07 PM

To answer my own question, this seems to be working:

 

 

sectionActions.customPresentDetailModel = ^(SCTableViewSection *section, SCTableViewModel *detailModel, NSIndexPath *indexPath) {
        if (indexPath.row != NSNotFound) {
            // Do my own custom presentation of the detailModel.viewController
        }
        else {
            UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailModel.viewController];

            detailNavigationController.preferredContentSize = detailModel.viewController.preferredContentSize;
            detailNavigationController.modalPresentationStyle = SCPresentationModeModal;

            [section.ownerTableViewModel.viewController presentViewController:detailNavigationController animated:YES completion:nil];
        }
    };

  • Tarek likes this
Cheers,

Dave

www.dgapps.ie

#3 Dave Guerin

Dave Guerin

    Forum Master

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 539 posts
  • LocationIreland
Reputation: 134
Popular

Posted 25 July 2015 - 01:38 PM

Ah, but the detailNavigationController.modalPresentationStyle needs to be UIModalPresentationFormSheet for it to follow the STV default on an iPad.


  • Tarek likes this
Cheers,

Dave

www.dgapps.ie




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users