Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:34:21+00:00 2026-06-03T10:34:21+00:00

In the master-detail application template (using ARC, storyboards) in XCode 4.3.2, I am trying

  • 0

In the master-detail application template (using ARC, storyboards) in XCode 4.3.2, I am trying to change (more specifically replace) the detail view when an item in master table view is selected. I am trying to implement delegates/protocols for this.

What I am confused about is – which class should implement the methods defined in protocol – master or detail?

Having the detail view implement the protocol method makes sense to me since, I’ll be push/popping the view controllers in detail view based on the selection (passed as a string from master via the protocol method).

Here’s what I tried

1) Defined the protocol in MasterViewController.h

@protocol MasterViewDelegate <NSObject>
- (void)masterSelectionChanged:(NSString *)selection;
@end
@interface MasterViewController:UIViewContoller
@property (nonatomic, weak) id <MasterViewDelegate> delegate

2) in MasterViewController.m

@synthesize delegate;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [delegate masterSelectionChanged:@"Some string based on indexPath.row"];
}

3) in DetailViewController.h

#import "MasterViewController.m"
@interface DetailViewController:UINavigationController <MasterViewDelegate>
@end

4) in DetailViewController.m

#pragma mark - MasterViewDelegate
- (void)masterSelectionChanged:(NSString *)selection
{
    NSLog(@"the selection is: %s", selection);
    // WIll push/pop view over here, may be perform segues based on selection
}

In this process, upon selecting the rows in master table, nothing happened. No crash, no display of log, no error while building either. What did I miss over here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:34:22+00:00Added an answer on June 3, 2026 at 10:34 am

    You need to set the delegate property – at the moment it will be nil so nothing happens when you send messages to it. In the iPad template you can do this as follows, in the viewDidLoad of your detail view controller:

    [super viewDidLoad];
    if (self.splitViewController) // Means this won't be called if you use this code on iPhone too.
    {
        // According to comments your master controller is embedded in a nav controller
        UINavigationController *nav = (UINavigationController*)[self.splitViewController.viewControllers objectAtIndex:0];
        // I am assuming it is the root view controller
        MasterViewController *master = (MasterViewController*)nav.rootViewController;
        // Finally set the delegate
        master.delegate = self;
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Xcode 4.2 and iOS SDK 5.0 and Apple's Master-Detail Application Template for
In the master-detail application template for iPad in XCode 4.3, the master view (side
I've created a Master-Detail Application with Xcode 4.3. In the Master View I want
I have a master detail Application in xCode. In Master View Controller an Array
I'm using the template master detail application. I have added a modal segue from
I have a simple master-detail application and I'm using the detail view to configure
Newbie question here ... I've created a Master-Detail Application project in Xcode 4.2 using
I've created a bare bones Master/Detail iPad application using the supplied template. It creates
I created a project using Master-Detail Application template but i don't need a MasterView.
I started out with the Master-Detail application in XCode 4.2. It is my first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.