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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:30:34+00:00 2026-06-17T06:30:34+00:00

Ok, so my project (which does have Cocos2d) has 3 UITableViews. So far, I

  • 0

Ok, so my project (which does have Cocos2d) has 3 UITableViews. So far, I am only concerned with the first one, which is why I am only pasting the code for the first one. The problem is, whenever I use the app, the table view shows up, with all of it’s content. The edit/done button also shows up as it is supposed to in the right hand corner. However, whenever I try to hit the edit button, the button switches to Done, but there is no delete icon near the cells, nor can I delete the cells. I have tried many solutions, but none of them seem to work. Thanks in advance.

-(id)init{
if (self == [super init]) {
    // Create initialized instance of UITabBarController
    tabController = [[UITabBarController alloc] init];
    // Create initialized instance of NSMutableArray to hold our UINavigationControllers
    tabArray = [[NSMutableArray alloc] init];

    // Create first UIViewController
    questionController = [[UIViewController alloc] init];
    [self makeQuestionTable];
    [questionController setTitle:@"Question"];
    // Initialize the UINavigationController
    navigationController = [[UINavigationController alloc] initWithRootViewController:questionController];
    questionController.navigationItem.rightBarButtonItem = questionController.editButtonItem;
    questionTableView.allowsSelection = YES;
    questionTableView.allowsMultipleSelectionDuringEditing = YES;
    questionTableView.allowsSelectionDuringEditing = YES;
    // Add UINavigationController to you tabs
    [tabArray addObject:navigationController];
    // Release UIViewController and UINavigationController
    [questionController release], [navigationController release];

    // Create second UIViewController
    answerController = [[UIViewController alloc] init];
    [self makeAnswerTable];
    [answerController setTitle:@"Answer"];
    // Initialize the UINavigationController
   navigationController = [[UINavigationController alloc] initWithRootViewController:answerController];
    // Add UINavigationController to you tabs
    [tabArray addObject:navigationController];
    // Release UIViewController and UINavigationController
    [answerController release], [navigationController release];


    // Create third UIViewController
    colorController = [[UIViewController alloc] init];
    [self makeColorTable];
    [colorController setTitle:@"Color"];
    // Initialize the UINavigationController
    navigationController = [[UINavigationController alloc] initWithRootViewController:colorController];
    // Add UINavigationController to you tabs
    [tabArray addObject:navigationController];
    // Release UIViewController and UINavigationController
    [colorController release], [navigationController release];

    // Add the tabs to the UITabBarController
    [tabController setViewControllers:tabArray];
    // Add the view of the UITabBarController to the window
    [[[CCDirector sharedDirector]view]addSubview:tabController.view];
}
return self;
}
-(void)setEditing:(BOOL)editing animated:(BOOL)animated{

[questionTableView setEditing:editing animated:animated];
[questionController setEditing:editing animated:animated];

}
-(void)makeQuestionTable{
questionTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)          style:UITableViewStylePlain];
questionTableView.backgroundColor = [UIColor whiteColor];
questionTableView.delegate = self;
questionTableView.dataSource = self;
questionTableView.tag = 1;
[questionTableView reloadData];
[questionController.view addSubview:questionTableView];
}

-(void)makeAnswerTable{
answerTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)     style:UITableViewStylePlain];
answerTableView.backgroundColor = [UIColor whiteColor];
answerTableView.delegate = self;
answerTableView.dataSource = self;
answerTableView.tag = 2;
[answerTableView reloadData];
[answerController.view addSubview:answerTableView];

}

-(void)makeColorTable{

colorTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 400) style:UITableViewStylePlain];
colorTableView.backgroundColor = [UIColor whiteColor];
colorTableView.delegate = self;
colorTableView.dataSource = self;
colorTableView.tag = 3;
[colorTableView reloadData];
[colorController.view addSubview:colorTableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
  if (currentTab == 1) {
    return [appDelegate.questionArray count];
}
else if (currentTab == 2) {
    return [appDelegate.answerArray count];
}
else if (currentTab == 3) {
    return [appDelegate.colorArray count];
}
else{
    return 0;
}
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
{
if (tableView.tag == 1) {


static NSString *simpleTableIdentifier = @"SimpleTableItem";

UITableViewCell *cell = [tableView     dequeueReusableCellWithIdentifier:simpleTableIdentifier];

if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [appDelegate.questionArray objectAtIndex:indexPath.row];
    return cell;
    NSLog(@"Question");
}
if(tableView.tag == 2){

    static NSString *simpleTableIdentifier = @"SimpleTableItem";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
    }
    cell.textLabel.text = [appDelegate.answerArray objectAtIndex:indexPath.row];
    return cell;
    NSLog(@"Answer");
}
if(tableView.tag == 3){

    static NSString *simpleTableIdentifier = @"SimpleTableItem";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
    }
    cell.textLabel.text = [appDelegate.colorArray objectAtIndex:indexPath.row];
    return cell;
    NSLog(@"Color");
}
}
- (UITableViewCellEditingStyle)tableView:(UITableView*)tableView
       editingStyleForRowAtIndexPath:(NSIndexPath*)indexPath {
UITableViewCell *cell = [questionTableView cellForRowAtIndexPath:indexPath];
if ([cell isEditing]) {
    NSLog(@"YES");
}
else{
    NSLog(@"NO");
}
return UITableViewCellEditingStyleDelete;
}
// This only needs to be implemented if you are going to be returning NO
// for some items. By default, all items are editable.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath     {
// Return YES if you want the specified item to be editable.
return YES;
}

// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:    (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
    //add code here for when you hit delete
    [questionTableView delete:indexPath];
}
}
  • 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-17T06:30:35+00:00Added an answer on June 17, 2026 at 6:30 am

    In your edit button action, you need to give setEditing as YES.

    [tableView setEditing:YES animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which has some lib's associated with it (in Build Path).
I've been working on my first iPad based project which has proven a massive
I have an iPhone project which currently does not have a UINavigationController in it.
I have crated SSIS project which does the following thing Control Flow :- Data
I have a GitHub project which does the same thing (a simple RogueLike game
I have a project which does financial reports and I want to let user
I have several classes in a project which need to only be in certain
I have two projects, the DLL project which has all my logic and data
I have a GWT project which has its source managed in SVN, is packaged
I have two models Project which has has_and_belongs_to_many :users and Users which has has_and_belongs_to_many

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.