logo
down
shadow

how to stop another rows to be select after select a row in uitableview


how to stop another rows to be select after select a row in uitableview

By : user2956674
Date : November 22 2020, 10:56 AM
wish of those help Add tableView.allowsSelection = false to didSelectRowAtIndexPath: and then re-set it to true at the appropriate time (I'm guessing after your web service stuff completes).
ADDED:
code :
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    if !(selectedRows as NSArray).containsObject(indexPath.row) {
        // Request data from web service because this row has not been selected before
        selectedRows.append(indexPath.row) // Add indexPath.row to the selectedRows so that next time it is selected your don't request data from web service again
        let cell = tableView.cellForRowAtIndexPath(indexPath) as UITableViewCell
        cell.selectionStyle = UITableViewCellSelectionStyle.None
    }
}
- (NSMutableArray *)selectedRows
{
    if (!_selectedRows) {
        _selectedRows = [[NSMutableArray alloc] init];
    }
    return _selectedRows;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (![self.selectedRows containsObject:indexPath.row]) {
        // Request data from web service because this row has not been selected before
        [self.selectedRows addObject:indexPath.row]; // Add indexPath.row to the selectedRows so that next time it is selected your don't request data from web service again
        UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
}


Share : facebook icon twitter icon
How to select Multiple rows in UITableView?

How to select Multiple rows in UITableView?


By : Marty Buffy
Date : March 29 2020, 07:55 AM
hope this fix your issue I want multiple selection in UITableView and also its data into one array or in one dictionary...
code :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];

    if ([selectedCell accessoryType] == UITableViewCellAccessoryNone) {
        [selectedCell setAccessoryType:UITableViewCellAccessoryCheckmark];
        [selectedIndexes addObject:[NSNumber numberWithInt:indexPath.row]];
    } else {
        [selectedCell setAccessoryType:UITableViewCellAccessoryNone];
        [selectedIndexes removeObject:[NSNumber numberWithInt:indexPath.row]];
    }

    [tableView deselectRowAtIndexPath:indexPath animated:NO];

}
How to select multiple rows in UITableview

How to select multiple rows in UITableview


By : Luis Mario Alvarez
Date : March 29 2020, 07:55 AM
wish of those help I want to select multiple rows in UITableview. I can select but my problem is when I scroll the UITableView there is an automatic selection of particular row. I am using this code : , Further code is use for the multiple selection in UITableview
code :
#import "RootViewController.h"

@implementation RootViewController

@synthesize arForTable = _arForTable;
@synthesize arForIPs = _arForIPs;

- (void)viewDidLoad {
    [super viewDidLoad];
    self.arForTable=[NSArray arrayWithObjects:@"Object-One",@"Object-Two",@"Object-Three",@"Object-Four",@"Object-Five", nil];
    self.arForIPs=[NSMutableArray array];
}

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    if([self.arForIPs containsObject:indexPath]){
        [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
    } else {
        [cell setAccessoryType:UITableViewCellAccessoryNone];
    }
    cell.textLabel.text=[self.arForTable objectAtIndex:indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if([self.arForIPs containsObject:indexPath]){
        [self.arForIPs removeObject:indexPath];
    } else {
        [self.arForIPs addObject:indexPath];
    }
    [tableView reloadData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
    [super viewDidUnload];
}



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

@end
Easier way to select all rows in UITableView

Easier way to select all rows in UITableView


By : Drew Griffiths
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further This is the only way to select all the cells. The real question is why are you wanting to select all the cells? Are you selecting them to get UITableView delegate callbacks? Are you selecting them for UI purposes?
Select and Deselect UITableView Rows

Select and Deselect UITableView Rows


By : Dipu Rahman
Date : March 29 2020, 07:55 AM
will be helpful for those in need I have TableView with multiple rows, I am selecting them and adding them to the Label text when i deselect any of the row I am unable to remove it from Label Text , you can add a flag - hasSelected in CategoryDB
code :
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if tableView == categoryTable
    {
        categoryList = categoryData[indexPath.row] as! CategoryDB

        categoryList!.hasSelected = true

        refreshLabel()
    }
func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
if tableView == categoryTable
    {
        categoryList = categoryData[indexPath.row] as! CategoryDB

        categoryList!.hasSelected = false

        refreshLabel()
    }
func refreshLabel(){
     var label = ""
     for object in categoryData as! CategoryDB {
        if(object.hasSelected){
            label += "\(categoryList!.category), "
        }
     }
     categoryLabel.text! = label
How can I select multiple rows in UITableView

How can I select multiple rows in UITableView


By : Jonas Oum
Date : March 29 2020, 07:55 AM
Related Posts Related Posts :
  • How to show downshift + popper on top of material-ui dialog?
  • jQuery file upload and RequireJS configuration
  • How to send the result of a select query to a message body of a mail in oracle 10G
  • Worklight common build failing with "Failed to update main HTML file"
  • pg_listening_channels() is not returning the channels name
  • Asset management in ZF2
  • Does the Firefox add-on sdk allow direct modification of the http response byte stream?
  • How to remove menu hardware key from your android app
  • Identifying programming language
  • Use shell commands to find Makefile.am in configure.ac
  • Mono Compiler as Service or Microsoft Roselyn for a vb parser
  • How to add extra root nodes for not well formed XML structure?
  • which Uncrustify setting replaces blank lines with indenting spaces?
  • mac OSX Lion Homebrew install curl (77)
  • In Project Euler 47, why is 2^2 considered a prime number distinct from 2?
  • browserstack requesting localhost:45691
  • What was the real reason why Google is chosing RenderScript instead of OpenCL?
  • Mandrill Inbound Email routing
  • Prevent checkElementIndex() Guava function from concatenating additional response to existing error message
  • Arduino and Raspberry Pi Serial communication + multiple variables
  • convert a 960 grid based site to responsive
  • Should it be possible to have more than one DocuSign account (DEMO) with the same email address?
  • Is it possible to limit ammount of concurrent builds in Travis-CI
  • Selecting languages with specific ISO code
  • Deprecated vs Unsupported SDK
  • Verifying ClearCase files have been labeled properly
  • What's the difference between "Bag of Words" and "Bag of features" in computer vision?
  • Is there a way to tell Serde to use a struct field as a map's key?
  • ld:framework not found sfml
  • nice, go-idiomatic way of using a shared map
  • IzPack ChmodInstallerListener.jar
  • Breaking down tasks of user stories between developer and QA
  • Dropwizard service not starting properly
  • How to override devise invitable actions
  • Coded UI. How can I change TimeOut in Find() method
  • Why when I click on the update button error TypeError: r is undefined happen?
  • Visio Component Diagram - Required Interface
  • Lucene: fast(er) to get docs in bulk?
  • can I use windows 8 font (Segoe UI)for my web app?
  • Using Flask Session in Gevent Socket-IO
  • Difference between recommended and suggested cookbooks
  • Dynamic Forms (Formsets) in Flask / WTForms?
  • Image Servlet doesn't want to show image in browser (FireFox, IE..) but in Eclipse browser works?
  • Logback - how to get each logger logging to a separate log file?
  • In Crystal Reports, how do I keep a row from printing if the value is null?
  • iOS 6 Audio multi-route - use external microphone AND internal speaker simultaneously
  • Adding Comments in JasperReports template (jrxml)
  • Servicestack mini profiler
  • Logging with Castle Windsor, the Logging Facility and log4net
  • Subscribe for instances list update in GCE autoscaled group
  • Generating a unique QR code for each Order in Woocommerce
  • libvirtError: internal error Cannot find suitable CPU model for given data
  • CKEditor changing content automatically
  • Pass double pointer in a struct to CUDA
  • Apache Camel for TCP based streamer
  • How to convert old CDC mainframe PRUs to bytes?
  • compilation on Blue Gene Q - ELF header
  • Set border of a jasper subreport having a title and a detail band
  • How to highlight tpl file?
  • cygwin: Starting cron as a service (access denied)
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org