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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:17:59+00:00 2026-06-09T17:17:59+00:00

Can i hide my button inside cell when edit mode? My cell populate by

  • 0

Can i hide my button inside cell when edit mode? My cell populate by array, save in plist. This is my code

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

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [titleArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"the indexpath.row = %i",indexPath.row);

    UITableViewCell *cell = [[UITableViewCell alloc]init];

    button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [button setFrame:CGRectMake(250.0, 25.0, 30.0, 30.0)];
    [button setTitle:@"!" forState:UIControlStateNormal];
    [button setTitle:@"X" forState:UIControlStateSelected];
    [button setTag:indexPath.row + 100];
    [button addTarget:self action:@selector(onoffBtn:) forControlEvents:UIControlEventTouchUpInside];

    // my label code

    UIImageView *bgCell = [[UIImageView alloc]initWithFrame:CGRectMake(0,0 , 320, 80)];
    bgCell.image = [UIImage imageNamed:@"BG.jpeg"];

    [cell.contentView addSubview:button];
    // other cell contentView addSubview everything

    return cell;
    [tableView reloadData];
}

This is my edit button

- (IBAction)editBtn:(id)sender
{
    UIButton *editBtn = (UIButton *)sender;
    editBtn.selected = !editBtn.selected;

    if (editBtn.selected)
    {
        button.hidden = YES;
        [self.tableView setEditing:YES animated:YES];
    }
    else
    {
        button.hidden = NO;
        [self.tableView setEditing:NO animated:YES];
    }
}

with above code, my button hide in last cell only, just say if i have 3 cells. How do i hide all button hide when in edit mode? i want all button is hiding. Below is my onoffBtn.

- (IBAction)onoffBtn:(id)sender
{
    tempIndexPath = [_tableView  indexPathForCell:(UITableViewCell*)[[sender superview] superview]];
    UITableViewCell *cell = [_tableView cellForRowAtIndexPath:tempIndexPath];
    UIButton *onoffBtn = (UIButton *)[cell.contentView viewWithTag:tempIndexPath.row+100];

    onoffBtn.selected = !onoffBtn.selected;
    if (onoffBtn.selected)
    {
        // start
    }
    else
    {
        // stop
    }
}

Please teach me more. Thank you.

  • 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-09T17:18:00+00:00Added an answer on June 9, 2026 at 5:18 pm

    You will have to call this method for all the UiTableViewCells of the table:

     if (editBtn.selected)
            {
    
    for (int row = 0, rowCount = [_iTableView numberOfRowsInSection:0]; row < rowCount; ++row) {
            UITableViewCell *cell = [_iTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]];
    
          UIButton *onoffBtn = (UIButton *)[cell.contentView viewWithTag:tempIndexPath.row+100];
         onoffBtn.hidden=YES;
        }
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can hide particular button which is created from UIBarButtonItem in iphone ?
HTML: <div id=box>my box</div>​ How come I can hide a visible div like this:
This is followup question from my previous question Toggle button inside accordion using jquery
I am trying to implement a show/hide EXIF data button inside Shadowbox. Here's the
Is there anyway you can 'hide' all the DisplayObjects around the crosshairs on a
I understand how the new keyword can hide methods in a derived class. However,
What is the simplest way I can hide a sensitive identifier, while providing some
I am looking to format the datagridview so I can hide and format certain
I can't hide my div using some i.e. explode effect in jquery ui, It
How can I hide a field in a SharePoint alert? I have a custom

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.