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 6682563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:43:14+00:00 2026-05-26T04:43:14+00:00

I’ve thoroughly looked for a solution and have not found one. It seems really

  • 0

I’ve thoroughly looked for a solution and have not found one. It seems really elementary what I’m trying to do, however all the webpages which I have read so far do not address them.

I have a two sets of the 3 usual files.

  • MyTableViewController.h .m .xib
  • TableViewDetails.h .m .xib

When the user clicks on a row on the MyTableViewController.xib, it displays TableViewDetails.xib with the contents of an array, declared/populated in MyTableViewController.

  • For Demo sake I want to call the array (tableDataList) by passing the number row of the item, the code which think can implement this is commented out

So how do I achieve this?

MyTableViewController.h

@interface MyTableViewController : UITableViewController {
    NSMutableArray *tableDataList;
}

@property (nonatomic, retain) IBOutlet UINavigationController *navCont;
@property (nonatomic, readwrite, retain) NSMutableArray *tableDataList;

//+ (NSString *)getTempArray:(int)number;
//- (NSString *) getTempArray_m: (int) number;   
@end

MyTableViewController.m

//#import "MyTableViewController.h"
#import "TableViewDetailsView.h"

@implementation MyTableViewController
@synthesize tableDataList;


- (void)viewDidLoad
{
    NSMutableArray *tempArray = [[[NSMutableArray alloc] initWithObjects:@"Item 1",@"Item 2",@"Item 3",@"Item 4",@"Item 5",@"Item 6", nil] autorelease];

    tableDataList = [[NSMutableArray alloc] init];
    tableDataList = tempArray;
}

//+ (NSString *)getTempArray:(int)number {
//    return [MyTableViewController getTempArray_m: number];
//}
//
//- (NSString *)getTempArray_m:(int)number {
//    
//    return [self.tableDataList objectAtIndex:number];
//}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
    NSLog(@"pushing...");
    TableViewDetailsView *temp = [[[TableViewDetailsView alloc] initWithNibName:@"TableViewDetailsView"bundle:nil] autorelease];
     // ...
     // Pass the selected object to the new view controller.

     [self.navCont pushViewController:temp animated:YES];
}
@end

MyTableViewController.h

#import <UIKit/UIKit.h>
//#import "MyTableViewController.h"
//@class MyTableViewController;

@interface TableViewDetailsView : UIViewController {
    UIButton *buttonGetArray;
}   
@end

TableViewDetailsView.m

#import "TableViewDetailsView.h"
//#import "MyTableViewController.h"

@implementation TableViewDetailsView


- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

//    MyTableViewController *MyTableVC = [[MyTableViewController alloc] init]; - This is Wrong
//    NSString *item = [MyTableViewController getTempArray:1];
//    NSLog(@"The Array item: %@", item);

}

Last few words, could you please provide actual code alterations and not pad this questions off or provide a link to readings. I really want to learn but find that its not very helpful when (what seems like) simple questions aren’t addressed here.
By all means give me the relevant pointers to the information, but solve the problem here first so others in future may benefit greater.
Thank you for taking the time to read my question.

  • 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-05-26T04:43:15+00:00Added an answer on May 26, 2026 at 4:43 am

    There are a few things to do here.
    First, in

    MyTableViewController.m

    NSMutableArray *tempArray = [[[NSMutableArray alloc] initWithObjects:@"Item 1",@"Item 2",@"Item 3",@"Item 4",@"Item 5",@"Item 6", nil] autorelease];
    
    // Use the setter of your instance variable here.
    self.tableDataList = tempArray;
    
    // Release your temp array (when you don't use ARC)
    [tempArray release];
    

    In

    TableViewDetailsView.h
    you should provide a public instance variable so you can set the details you want to display. Right now it is a string you want to display. Later it could be a custom model with data. One way to do it is to declare the @property. For example in TableViewDetailsView.h:

    @property (nonatomic, retain) NSString *myDetailString;
    

    So you initalize your DetailViewController and set the data you want to display right when the user taps the row. So in your “- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath” in MyTableViewController.m you do:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    TableViewDetailsView *temp = [[TableViewDetailsView alloc] initWithNibName:@"TableViewDetailsView"bundle:nil]; // No autorelease here!
    
     // Use the declared instace variable of the detailViewController
     temp.myDetailString = [self.tableDataList objectAtIndex:indexPath.row];
    
     [self.navCont pushViewController:temp animated:YES];
    
     // Clean up
     [temp release];
    }
    

    If you declare your myDetailString as an IBOutlet, you can link it with your .xib file and set it up in Interface Builder. Otherwise you would have to set it up in code, For example in your viewDidLoad method. The string to display is already set inside the other method (didSelectRowAtIndexPath)…
    Hope that clears some things. Otherwise ask again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.