SplitViewController showDetailViewController without animation?

I'm just wondering if it is possible to show the detailed view controller without animating it (by sliding into the window on the right). I expect there will be some kind of animated boolean parameter there, but it looks like it won't.

That is all I have:

[self.splitViewController showDetailViewController:detailViewController sender:self];


Am I missing something? Or is there no way to do this?


source to share

2 answers

This can be done using the class method performWithoutAnimation

on UIView

, for example:

[UIView performWithoutAnimation:^{
    [self showDetailViewController:_detailedViewController sender:self];




Two options, you can use a delegate to load the view controller. You will need to implement the method splitViewController:showDetailViewController:sender:

. Alternatively (although the docs seem to discourage this), you can simply directly assign your new detailViewController to the splitViewController property viewControllers


NSArray *vcArray = @[self.splitViewController.viewControllers[0],detailViewController];
self.splitViewController.viewControllers = vcArray;


Technically, you should check that the existing viewControllers array has two elements first.



All Articles