Note that there are some explanatory texts on larger screens.

plurals
  1. POFetching cells having checkmark accessory
    primarykey
    data
    text
    <p>I am working with the table view. I added the checkmark Accessory on the first tap of the screen and removed this checkmark on the second tap. I added few ckeckmarks on the cells of table view. Now i want that the labels of the cells having the checkmarks should be displayed on the NSlog. please help me out regarding this issue. Any help will be much appriciable.</p> <pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (tableView.tag == 0) { return [celltitles count]; } else { return 7; } } - (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]; } if (tableView.tag == 0) { cell.textLabel.text = [celltitles objectAtIndex:indexPath.row]; if (indexPath.row == 0) { habitname = [[UITextField alloc]initWithFrame:CGRectMake(150, 0, 150, 50)]; habitname.placeholder = @"Habit Name"; habitname.delegate= self; [cell addSubview:habitname]; } else if (indexPath.row == 1) { timelbl = [[UILabel alloc] initWithFrame:CGRectMake(100, 0, 220, 50)]; timelbl.text = @"OFF"; timelbl.textAlignment = NSTextAlignmentCenter; [cell addSubview:timelbl]; timetitlelbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 50)]; timetitlelbl.text = @"Alert"; timetitlelbl.textAlignment = NSTextAlignmentCenter; [cell addSubview:timetitlelbl]; toggleswitch = [[UISwitch alloc] initWithFrame:CGRectMake(250, 5, 50, 60)]; toggleswitch.on = NO; [toggleswitch addTarget:self action:@selector(toggleSwitch) forControlEvents:(UIControlEventValueChanged | UIControlEventTouchDragInside)]; [cell addSubview:toggleswitch]; } } else if (tableView.tag == 1) { cell.textLabel.text = [daysarray objectAtIndex:indexPath.row]; } return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 1) { if (toggleswitch.on) { [self datepickershown:timelbl.text animated:YES]; if (self.datePickerIsShowing) { //[self datepickershown]; //[self hideDatePickerCell]; [dscptxt resignFirstResponder]; } else { [dscptxt resignFirstResponder]; [self.timelbl resignFirstResponder]; [self showDatePickerCell]; } } else { timelbl.textColor = [UIColor grayColor]; } } else if (indexPath.row &gt; 2 &amp;&amp; indexPath.row &lt;10) { NSLog(@"I am Selectin the row"); UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; if (cell.accessoryType == UITableViewCellAccessoryNone) { cell.accessoryType = UITableViewCellAccessoryCheckmark; } else if (cell.accessoryType == UITableViewCellAccessoryCheckmark) { // NSLog(@"Selected Accessory Is %d",cell.accessoryType); cell.accessoryType = UITableViewCellAccessoryNone; } } [self.tableview deselectRowAtIndexPath:indexPath animated:YES]; } - (void)savedata:(id)sender { } </code></pre> <p>Above is the code which i am using and on the save action i want the log.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload