1

SplitViewControllerの前にRootViewControllerを挿入したい。AppDelegateの私のコードは次のとおりです。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [_window addSubview:[_viewController view]];
    [_window makeKeyAndVisible];

    return YES;
}

rootviewcontrollerに呼び出しを委任します。これで、splitviewcontrollerに呼び出します。

- (void)viewDidLoad
{
    [super viewDidLoad];

    SplitViewController *splitViewController = [SplitViewController initApp];
    [[self navigationController] pushViewController:splitViewController animated:YES];

}

私のSplitViewControllerには、次のメソッドがあります。

+ (YetSplitViewController*) initApp
{
    YetSplitViewController * cont = [[YetSplitViewController alloc] initWithNibName:@"YetSplitViewController" bundle:nil];
    if (NO) 
    { 
        cont.splitWidth = 15.0;
    }
    return [cont autorelease];
}

その後は良くない……。

デリゲートからSplitViewControllerへの最初のコード呼び出し:

@interface TemplateAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong,   nonatomic)    IBOutlet UIWindow               *window;
@property (readonly, nonatomic)    IBOutlet YetSplitViewController *splitViewController;

@property (readonly, nonatomic)    IBOutlet MasterViewController   *rootViewController;
@property (readonly, nonatomic)    IBOutlet DetailViewController   *detailViewController;

@end

@implementation TemplateAppDelegate

@synthesize window                   = _window;
@synthesize splitViewController      = _splitViewController;
@synthesize rootViewController       = _rootViewController;
@synthesize detailViewController     = _detailViewController;


- (void)dealloc
{
    [_window release];
    [_splitViewController release];

    [_rootViewController release];
    [_detailViewController release];

    [super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    if (NO) 
    { 
    _splitViewController.splitWidth = 15.0;
    }

    [_window addSubview:_splitViewController.view];
    [_window makeKeyAndVisible];

    return YES;
}

@end
4

0 に答える 0