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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:37:45+00:00 2026-06-15T22:37:45+00:00

I have a UITableView which I am creating by using custom UITableViewCell . The

  • 0

I have a UITableView which I am creating by using custom UITableViewCell. The tableview shows some data populated from an array. Now I am using 2 image to highlight/unhighlight based on selection. [By default when application opens I am showing the first row with highlighted image without any selection].

The UITableView header contains one delete button now if I press delete button first time it happens succesfully.

-(IBAction)delete{
    [myArray removeObjectAtIndex:0];
    [tableview reloadData];
}

Now as tableview get refreshed, all row contains unhighlighted image. Now as I select 3rd row and press header delete button how should I get the index number to be deleted.

I know about didSelectRowAtIndexPath but is there any way which I put in IBAction method to get the selected cell index number?

  • 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-15T22:37:46+00:00Added an answer on June 15, 2026 at 10:37 pm

    Just create an ivar or property that holds the value of the latest selection. In the didSelectRowAtIndexPath method, have this line:

    self.rowSelected = indexPath.row;
    

    where rowSelected is a property. Then in your IBAction for the button, you can access that property:

    -(IBAction)delete{
        if (self.rowSelected != -1){
            [myArray removeObjectAtIndex:self.rowSelected];
            [tableview reloadData];
            self.rowSelected = -1;
    }
    

    In the viewDidLoad method you should set the value of that property to 0 since you want the first row selected at start up.

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

Sidebar

Related Questions

I have a UITableView which is populated with some parsed JSON twitter data. The
I have a UITableView which I want to populate with details from an array
I have a UITableView which is populated with an array of objects of type
In my app, I have a UITableView which has some custom cells and in
I have a UITableView instance tableView that displays data from a server. The tableView
I have UITableView which uses a custom UITableViewCell containing a UITextField . I want
I am using a UITableView to display some data which the user can filter.
I have a UITableView which is populated by an array, I have a button
I have a custom UITableViewCell which I created in Interface Builder. I am successfully
I have an events app which gets events data from sqlite database and displays

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.