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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:01:23+00:00 2026-06-01T04:01:23+00:00

I have a UITableView , which when I select a row, I want to

  • 0

I have a UITableView, which when I select a row, I want to segue to another view, where the details of the tank are displayed… The segue happens, but the delegate does not send the object etc over… I think I have my knickers in a twist over where the delegate is declared/synthesized and implemented etc…

Here is where I declare the delegate in the header file of the UITableViewController:

@class iTanksV2ListViewController;
@protocol iTanksV2ListViewControllerDelegate
- (void) iTanksListViewController:(iTanksV2ListViewController *) sender choseTank:(tank *)tank;
@end
@interface iTanksV2ListViewController : UITableViewController
@property (weak, nonatomic) id <iTanksV2ListViewControllerDelegate> delegate;
@end

and this is what I have in the UITableViewControllers m file:

@implementation iTanksV2ListViewController
@synthesize delegate = _delegate;

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.tankTableView.delegate = self;
    self.tankTableView.dataSource = self;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    self.selectedTank = [self.tanks objectAtIndex:indexPath.row];
    [self.delegate iTanksListViewController:self choseTank:self.selectedTank];
}

…and then here is the code I have for the delegate in the DetailViewController implementation file…

@interface tankDetailViewController () <iTanksV2ListViewControllerDelegate>
@end

-(void)iTanksListViewController:(iTanksV2ListViewController *)sender choseTank:(id)tank
{
    self.tankToShow = tank;
}

All the other variables etc are declared, I have left them out in the hope it makes things clearer – the code compiles, and the segue happens but the delegate doesn’t seem to do anything!!!

  • 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-01T04:01:25+00:00Added an answer on June 1, 2026 at 4:01 am

    You mention segues so I’m assuming you’re using a storyboard. If that’s true, forget about delegates for this purpose. A delegate is supposed to be an object that performs some action for another but all you need is data transfer.

    I suggest using the prepareForSeque: method instead in your iTanksV2ListViewController class. Keep the line that sets self.selectedTank when a row is tapped but then put something like this in prepareForSegue:

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        tankDetailViewController *next = (tankDetailViewController *)[segue destinationViewController];
        next.tankToShow = self.selectedTank;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to select a row in my UITableView after the view did load.
I have UITableView.when i click on it's 1 st row one another UITableView opens
I have 5 cells in my tableview. User can select a row which sets
I have a UITableView which from an external RSS feed. When you select a
I have a UITableView on a view. This UITableView has cells which are made
I have a UITableView which I present in a UIPopoverController . The table view
I have created one application in which if i select on particular row in
I have a UI which contains a UITableView and a UIDatePicker. When I select
I have a UITableView with 3 empty rows. The user can select which text
I have a UITableView which is populated by an array, I have a button

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.