Note that there are some explanatory texts on larger screens.

plurals
  1. POUIViewController is deallocated before delegate method is called
    primarykey
    data
    text
    <p>I have <code>PreviewController</code> : <code>UIViewController</code> which is used to show document in full screen it's part of <code>UINavigationViewController</code>. Also it's delegate of <code>UISplitViewController</code>.</p> <p>When it's pushed, it hides <code>masterView</code> of <code>UISplitViewController</code>. (Methods 1 - 3 - 2 are called)</p> <p>When it disappears (by pressing "back" button), it shows <code>masterView</code> of <code>UISplitViewController</code>. (Methods 4 - 2 are called)</p> <p>But there is a way to force closing <code>PreviewController</code>. In this case only method 4 is called and <code>PreviewController</code> is deallocated before <code>UISplitViewController</code> can send message and call Method 2.</p> <p>How can I resolve this problem? Is there a way to force <code>UISplitViewController</code> to call it's delegate method? Or can I retain <code>PreviewController</code> in Method 4 and release it in Method 2 (using ARC)?</p> <pre><code>// Method 1 - (void)viewDidLoad { [super viewDidLoad]; self.hideMaster = YES; UISplitViewController *splitViewController = [(AppDelegate *)[[UIApplication sharedApplication] delegate] splitViewController]; splitViewController.delegate = self; } // Method 2 - (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation { return self.hideMaster; } // Method 3 - (void)viewWillAppear:(BOOL)animated { self.hideMaster = YES; UISplitViewController *splitViewController = [(AppDelegate *)[[UIApplication sharedApplication] delegate] splitViewController]; [splitViewController.view setNeedsLayout]; [splitViewController willRotateToInterfaceOrientation:self.interfaceOrientation duration:0]; } // Method 4 - (void)viewWillDisappear:(BOOL)animated { self.hideMaster = NO; UISplitViewController *splitViewController = [(AppDelegate *)[[UIApplication sharedApplication] delegate] splitViewController]; [splitViewController.view setNeedsLayout]; [splitViewController willRotateToInterfaceOrientation:self.interfaceOrientation duration:0]; } // PreviewController is created in UIViewController which belongs to UINavigationController PreviewController *previewVC = [[PreviewController alloc] initWithNibName:@"PreviewController" bundle:nil]; previewVC.documentURL = url; [self.navigationController pushViewController:previewVC animated:YES] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload