1

大きな問題があります: メソッド didSelectRowAtIndexPath では、常に null を self.navigationController.I に取得します。SplitViewController に基づくプロジェクトがあり、詳細 TableView で行が選択されたときに別のビューをプッシュしたいと考えています。

建築:

LoginView->SplitViewController->Master
                               ->Detail->AnotherView

My AppDelegate.m : ログインフォームを読み込みます

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

    // Initialize the app window
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

    AuthentificationViewController *authentificationViewController =[[AuthentificationViewController alloc] initWithNibName:@"AuthentificationView" bundle:nil];
    self.window.rootViewController=authentificationViewController;

    [authentificationViewController setModalTransitionStyle:UIModalTransitionStylePartialCurl];
    [self.splitViewController presentModalViewController:authentificationViewController animated:YES];

    [self.window makeKeyAndVisible];

    return YES;
}

AppDelagate の内部インターフェイスには、次のプロパティがあります。

@property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController;

@property (nonatomic, retain) IBOutlet UINavigationController *navController;

ログインフォームのキャンセルボタンをクリックしたときのメソッドハンドル

- (IBAction)btnCancel:(id)sender {

   AppDelegate* app_delegate=[[UIApplication sharedApplication] delegate];
    //self.window = [[UIApplication sharedApplication] keyWindow];
    app_delegate.window.rootViewController= app_delegate.splitViewController;

}

行を選択すると、次の Method があります。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

      if([indexPath row] == 0)
            {

                // show add bookmark controller

                BookmarkEditorController* bookmarkEditorController = [[[BookmarkEditorController alloc] initWithBookmark:[[ComputerBookmark alloc] initWithBaseDefaultParameters]] autorelease];

                [bookmarkEditorController setTitle:NSLocalizedString(@"Ajouter Connexion", @"Add Connection title")];
                [self.navigationController pushViewController:bookmarkEditorController animated:YES];

}

しかし、行を選択しても何も起こらず、navigationController が nil です。どうすれば修正できますか?

前もって感謝します

編集:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
      UIViewController *localdetailViewController =nil;
       if([indexPath row] == 0)
        {

            // show add bookmark controller

            BookmarkEditorController* bookmarkEditorController = [[[BookmarkEditorController alloc] initWithBookmark:[[ComputerBookmark alloc] initWithBaseDefaultParameters]] autorelease];

            [bookmarkEditorController setTitle:NSLocalizedString(@"Ajouter Connexion", @"Add Connection title")];

            localdetailViewController=bookmarkEditorController;
             AppDelegate *delegate =[[UIApplication sharedApplication] delegate];

            NSArray *viewControllers=[[NSArray alloc] initWithObjects: [delegate.splitViewController.viewControllers objectAtIndex:0],bookmarkEditorController,nil];
            delegate.splitViewController.viewControllers=viewControllers;



        }


}
4

1 に答える 1