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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:28:33+00:00 2026-06-01T00:28:33+00:00

I am working on an app in which I want to toggle the status

  • 0

I am working on an app in which I want to toggle the status of some devices on/off by changing the image view of the cell. I have my devices in a table view and I am setting the editing mode of the table view on a button click and it is editing fine, but the problem is that it only changes the image of the cells which are currently visible, whether or not I have previously selected some of the rows which are not visible right now. Here is my code. Tell me what I am missing or what I should do to change the selected rows which are not visible.

- (void)viewDidLoad{
deviceTableVIew.rowHeight = 72.0;
[deviceTableVIew setAllowsSelectionDuringEditing:YES];
[deviceTableVIew setAllowsMultipleSelectionDuringEditing:YES];

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"mainBackground.jpg"]];
btnControl.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"btn-conrol.png"]];  
[super viewDidLoad];
}

-(IBAction)control:(id)sender{
btnControl.enabled = false;
btnControl.hidden = true;        
btnCancel.enabled = true;
btnCancel.hidden = false;    
stateToggleToolbar.hidden = false;    
[self.deviceTableVIew setEditing:YES animated:YES];
}

-(IBAction)setDevicesOn:(id)sender{

NSArray *paths = [self.deviceTableVIew indexPathsForSelectedRows];
for (NSIndexPath *path in paths) {
    UITableViewCell *cell = (UITableViewCell *)[self.deviceTableVIew cellForRowAtIndexPath:path];
    cell.imageView.image = [UIImage imageNamed:@"device-on-image.png"];
}

controlStatus = NO;        
btnControl.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"btn-conrol.png"]];        
stateToggleToolbar.hidden = true;
}
  • 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-01T00:28:35+00:00Added an answer on June 1, 2026 at 12:28 am

    (I assume you have an array of custom objects or dictionaries somewhere that holds the information to populate your cells.)

    A better strategy is to have your setDevicesOn: method update that data model to indicate what image you wish to display and, when it’s finished, call reloadData. Then, when cellForRowAtIndexPath: is called, you can set the cell’s actual image based on that data element.

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

Sidebar

Related Questions

I have been working on an app which includes using the devices camera. After
I am working on an app in which I have some edit texts and
I am working on a app which requires me to store some directions for
I am working on an app which needs a very simple progress view .What
I have made an android app which working fine. I implemented the Login functionality
I have a WPF 4 app which I want to enable drag and drop
i m working on app,in which user taps to shoot bullets, i want user
I'm working on a lite version of my app in which I want to
I am working on pinging app in which I have a progress bar which
I am working on an app which I want to register in the Share

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.