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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:18:38+00:00 2026-06-01T02:18:38+00:00

I am trying to call a detail screen from a UITableView list – but

  • 0

I am trying to call a detail screen from a UITableView list – but the delegate is not being called in the receiving view – I’ll post all the code:

list header file:

#import <UIKit/UIKit.h>
#import "tank.h"

@class iTanksV2ListViewController;
@protocol iTanksV2ListViewControllerDelegate
     - (void) iTanksListViewController:(iTanksV2ListViewController *) sender choseTank:(tank *)tank;
@end

@interface iTanksV2ListViewController : UITableViewController
@property (nonatomic, strong) NSArray *tanks;
@property (weak, nonatomic) IBOutlet UITableView *tankTableView;
@property (weak, nonatomic) id <iTanksV2ListViewControllerDelegate> delegate;
@end

and the m file:

#import "iTanksV2ListViewController.h"
#import "tank.h"
#import "tankDetailViewController.h"

@interface iTanksV2ListViewController () 

@end

@implementation iTanksV2ListViewController
@synthesize tanks = _tanks;
@synthesize tankTableView = _tankTableView;
@synthesize delegate = _delegate;


- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this    view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)viewDidUnload
{
    [self setTankTableView:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;//keep this section in case we do need to add sections in the future.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [self.tanks count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Tank List Table Cell";
    UITableViewCell *cell = [self.tankTableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithFrame:CGRectZero];
    }
    tank *thisTank = [self.tanks objectAtIndex:indexPath.row];
    cell.textLabel.text = thisTank.tankNumber;
    return cell;
}

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([segue.identifier isEqualToString:@"Show Tank Details"])
    {

    }
}

#pragma mark - Table view delegate

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

}

@end

and the header for the receiving file:

#import <UIKit/UIKit.h>
#import "tankGauge.h"
#import "tank.h"

@interface tankDetailViewController : UIViewController 
@property (weak, nonatomic) IBOutlet UILabel *tankNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *tankProductLabel;
@property (weak, nonatomic) IBOutlet UILabel *tankAvailableProductLabel;
@property (weak, nonatomic) IBOutlet UILabel *tankMaxVolumeLabel;
@property (weak, nonatomic) IBOutlet tankGauge *tankVolumeGauge;
@property (weak, nonatomic)  tank* tankToShow;
@end

…and the m file:

#import "tankDetailViewController.h"
#import "iTanksV2ListViewController.h"

@interface tankDetailViewController () <iTanksV2ListViewControllerDelegate>

@end

@implementation tankDetailViewController
@synthesize tankNumberLabel = _tankNumberLabel;
@synthesize tankProductLabel = _tankProductLabel;
@synthesize tankAvailableProductLabel = _tankAvailableProductLabel;
@synthesize tankMaxVolumeLabel = _tankMaxVolumeLabel;
@synthesize tankVolumeGauge = _tankVolumeGauge;
@synthesize tankToShow = _tankToShow;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
}

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

- (void)viewDidUnload
{
    [self setTankNumberLabel:nil];
    [self setTankProductLabel:nil];
    [self setTankAvailableProductLabel:nil];
    [self setTankMaxVolumeLabel:nil];
    [self setTankVolumeGauge:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
  • 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-01T02:18:39+00:00Added an answer on June 1, 2026 at 2:18 am

    tankTableView is an IBOutlet, so you just need to connect your tableView’s delegate and data-source to your File's Owner in your xib as shown below:
    enter image description here

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

Sidebar

Related Questions

i'm trying to call a WCF service from my Silverlight 3 app. But... when
Trying to call a SAP SOAP Web Service from a generated sudzc app shows
I'm trying to call a web service from Excel 2003 module. The way i've
I'm trying to write a function that can call a webmethod from a webserive
I'm trying to call functions of a C DLL. But I got a StackOverflowException
I am trying to call the GetReportParameters method from the ReportingServices2005.asmx web service from
I'm trying to get my AJAX call working with the rails 3, but I'm
I apologize for such a long message in advance, but I'm trying for detail
I'm trying to call a stored procedure (on a SQL 2005 server) from C#,
I'm trying to set up a Master/Detail grid using the Grid control from Telerik's

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.