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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:56:30+00:00 2026-05-28T00:56:30+00:00

Hi i am developing app in which there will be multiple tables in single

  • 0

Hi i am developing app in which there will be multiple tables in single window, Code goes fine Build got Succeeded, But when i run the code in Stimulator it shows the error as:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x6a71730'

Please find my code and provide me siome suggestions to solve it.

Code Follows

#import <UIKit/UIKit.h>

@class ViewController;

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) ViewController *viewController;

@end

@implementation AppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;

- (void)dealloc
{
    [_window release];
    [_viewController release];
    [super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}
@end

ViewController:

#import <UIKit/UIKit.h>
#import "tabelOne.h"
#import "tabelTwo.h"
#import "tabelThree.h"

@interface ViewController : UIViewController{
    tabelOne *tabel1;
    tabelTwo *tabel2;
    tabelThree *tabel3;


    UITableView *myTableView;
    UITableView *myTableView1;
    UITableView *myTableView2;

}

@property (retain, nonatomic) IBOutlet UITableView *myTableView;
@property (retain, nonatomic) IBOutlet UITableView *myTableView1;
@property (retain, nonatomic) IBOutlet UITableView *myTableView2;

@end


#import "ViewController.h"

@implementation ViewController
@synthesize myTableView;
@synthesize myTableView1;
@synthesize myTableView2;




- (void)viewDidLoad {
    [super viewDidLoad];
    if (tabel1 == nil) {
        tabel1 = [[tabelOne alloc] init];
    }
    if (tabel2 == nil) {
        tabel2 = [[tabelTwo alloc] init];
    }
    if (tabel3 == nil) {
        tabel3 = [[tabelThree alloc] init];
    }

    [myTableView setDataSource:tabel1];
    [myTableView1 setDataSource:tabel2];
    [myTableView2 setDataSource:tabel3];

    [myTableView setDelegate:tabel1];
    [myTableView1 setDelegate:tabel2];
    [myTableView2 setDelegate:tabel3];


}


- (void)viewDidUnload
{
    [self setMyTableView:nil];
    [self setMyTableView1:nil];
    [self setMyTableView2:nil];

    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

- (void)dealloc {
    [myTableView release];
    [myTableView1 release];
    [myTableView2 release];
    [super dealloc];
}
@end

Table one:

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@interface tabelOne : UITableViewCell <UITableViewDataSource, UITableViewDelegate>{
    NSMutableArray *items;
}

@end
#import "tabelOne.h"

@implementation tabelOne


-(void)loadView
{
    if (items == nil) {
        items = [[NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"6",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",nil] retain];
    }
}

-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger) tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
    return [items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MyIdentifier"];
    }
    cell.textLabel.text = [NSString stringWithFormat:@"1.%@" ,[items objectAtIndex:indexPath.row]];
    return cell;
}

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    }

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {

    return UITableViewCellEditingStyleDelete;

}
- (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath {

    if(editingStyle == UITableViewCellEditingStyleDelete) {     
        //Delete the object from the table.
        [items removeObjectAtIndex:indexPath.row];
        [tv deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }
}

-(void) dealloc
{
    [items release];
    [super dealloc];
}

@end

and Similar code for table 2 and 3.

  • 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-28T00:56:31+00:00Added an answer on May 28, 2026 at 12:56 am

    First:
    Your Table is of a subclass UITableViewCell, this should be UITableView.

    Second:
    I assume the view controller is the delegate for the tableviews.
    Did you link the tableviews delegates and datasources to the view controller in the NIB?

    The view controller must provide the data for tables.
    THis is what the exception is saying:
    – Unrecognized selector. (tableView:numberOfRowsInSection:)

    This method is part of the UITableViewDatasource. You must implement different datasource methods.
    You can see which methods by making the controller conform to the protocol as so:

    @inteface ViewController : UIViewController <UITableViewDelegate, UITableViewDatasource>
    ....
    @end
    

    You should look at the UITableView reference here

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

Sidebar

Related Questions

I am developing a app in which there is a button which will clear
I'm currently developing an app which will use a Linq to SQL (or possibly
I'm developing an app which will have a central database users can add entries
I'm developing an application which will support multiple screens. I have created three layouts
I'm developing a MVC 3 Razor Web App, in which details of multiple categories
I'm developing a new app, I haven't previously written an app which will cater
I am developing a chronometer app for iPhone which will used by the drivers
I'm developing a live wallpaper app which will draw an analog clock. So far
I'm developing and Augmented Reality app for my school where there will be two
I am developing an app which will show some information in a detailview which

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.