Когда я использую замену, сбои приложения detailView segue.
Я заменяю кучу контроллеров представления (1-й - контроллер навигации, затем контроллер tabBar с контроллерами представления).TabBar Controller является делегатом splitViewController.
Сообщение об ошибке:
-[TabBarController splitViewController:shouldHideViewController:inOrientation:]:
message sent to deallocated instance 0x9b7d180
Обновление: код TabBarController
// TabBarController.m
#import "TabBarController.h"
@implementation TabBarController
@synthesize masterPopoverController = _masterPopoverController;
#pragma mark - View lifecycle
- (void)awakeFromNib // always try to be the split view's delegate
{
[super awakeFromNib];
self.splitViewController.delegate = self;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
self.delegate = self;
}
- (void)viewDidUnload
{
[super viewDidUnload];
self.splitViewController.delegate = nil;
self.delegate = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
#pragma mark - Split view
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{
// barButtonItem.title = NSLocalizedString(@"Master", @"Master");
// [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
// self.masterPopoverController = popoverController;
}
- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
// Called when the view is shown again in the split view, invalidating the button and popover controller.
// [self.navigationItem setLeftBarButtonItem:nil animated:YES];
// self.masterPopoverController = nil;
}
- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return NO;
}
@end