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

  • Home
  • SEARCH
  • 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 7707271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:19:04+00:00 2026-06-01T00:19:04+00:00

I have a UISplitViewController in which i’m attempting to pass an int value from

  • 0

I have a UISplitViewController in which i’m attempting to pass an int value from the MasterViewController to a DetailTableViewController. Both the master and the detail view controller are UITableViewControllers. I am attempting to pass the indexPath.row value from the master to the detail which will dictate which array of objects is loaded into the detailViewController’s tableview.

Some code from MasterViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int indexRowTouched = indexPath.row;

detailViewController = [self.splitViewController.viewControllers lastObject];
NSLog(@"%@", detailViewController);

detailViewController.detailItem = indexRowTouched;
NSLog(@"index row %i", indexRowTouched);

}

An exception is thrown here

detailViewController.detailItem = indexRowTouched;

2012-03-28 16:08:19.625 splittest2[14895:f803] -[UINavigationController setDetailItem:]: unrecognized selector sent to instance 0x6b592e0

From the DetailViewController.m

- (void)setDetailItem:(int)newDetailItem
{
if (_detailItem != newDetailItem) {
    _detailItem = newDetailItem;

    // Update the view.
    [self configureView];
    }

if (self.masterPopoverController != nil) {
    [self.masterPopoverController dismissPopoverAnimated:YES];
    }        
}

I also note that the value of detailItem logs “0” as soon as the detailView is loaded, before an indexPath row is selected at all.

Im wondering why this property is not being assigned from the MasterViewController, and the TableView is not being updated.

EDIT

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int indexRowTouched = indexPath.row;

detailViewController = (DetailViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];

detailViewController.detailItem = indexRowTouched;
NSLog(@"index row %i", indexRowTouched);

}

Trying to access the setDetailItem on the UINavigationController seems to have been fixed by changing the didSelectRowAtIndexPath to the above

  • 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-01T00:19:05+00:00Added an answer on June 1, 2026 at 12:19 am

    In your - (void)configureView function, you are doing

    if (self.detailItem) {
        if (detailItem == 0) {
            NSString *medPath = [[NSBundle mainBundle] pathForResource:@"general" ofType:@"plist"];
    
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:medPath];
    
            self.items = dict;
    
    
            NSMutableArray *array = [[NSMutableArray alloc] init]; 
    
            [array addObjectsFromArray:[[self.items allKeys]
                                        sortedArrayUsingSelector:@selector(compare:)]];
            self.keys = array;
    
        }
    
        //etc
    }
    

    Since detailItem is an int, not an object, if it is equal to 0, if (detailItem) will return false. Thus if you are sending 0 to detailItem, your configureView if statement will not be entered and nothing will happen.

    You should remove that outside if statement entirely and just have:

    - (void)configureView {
        if (detailItem == 0) {
            NSString *medPath = [[NSBundle mainBundle] pathForResource:@"general" ofType:@"plist"];
    
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:medPath];
    
            self.items = dict;
    
    
            NSMutableArray *array = [[NSMutableArray alloc] init]; 
    
            [array addObjectsFromArray:[[self.items allKeys]
                                        sortedArrayUsingSelector:@selector(compare:)]];
            self.keys = array;
    
        }
    
        //other cases for detailItem
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an UISplitViewController base project. I want to have a different detail View
In my iPad application, i have used UISplitViewController where master view contains table view
So I have an instance of MyViewController in the detail view of a UISplitViewController.
I have a UISplitViewController. When the app launches initially, the detail view is showing
I have a UISplitViewController setup with a custom view added as a subview of
I have the following setup: A subclass of UISplitViewController that creates the master and
I have a UISplitViewController which has a UIWebView assigned to its detailedView. The problem
I have a UISplitViewController, and I'd like to change the root view controller (on
When using Apple's UISplitViewController, the master view has a black toolbar when in portrait
When selecting a row from the master view of UISPlitViewControler when its in popover

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.