title: How to Set a tag Value in UITAbleView Cell and Pass It into URL in iOS?
body: <p>i am Newbie in iOS Development, i make an App that Contain <code>UITableView</code> I want to Set a Tag to <code>UITableViewCell</code> like as if it Was Selected then Cell tag is <code>1</code> else cell tag is <code>0</code> for that i Do Coding like as But it was always Set tag is equal <code>1</code> i want if cell was selected then tag is <code>1</code> else tag is equal to <code>0</code> Please Give me Solution for it. </p>
  
  <p>Here my Code like as</p>
  
  <p>in <code>viewDidLoad</code></p>
  
  <pre><code>NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
  SelectedRows = [NSMutableArray arrayWithArray:[userDef objectForKey:@"SelectedRows"]];
  </code></pre>
  
  <p>SelectedRows is <code>NSMutableArray</code></p>
  
  <pre><code>-(CategoryCustumCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  static NSString *CellIdentifier=@"Cell";
  CategoryCustumCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil)
  {
      NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"CategoryCustumCell" owner:self options:nil];
      cell=[nib objectAtIndex:0];
  }
  cell.categoryLabel.text=[self.categoryArray objectAtIndex:indexPath.section];
  
  NSNumber *obj = [NSNumber numberWithInteger:indexPath.section];
  if ([SelectedRows containsObject:obj])
  {
      cell.accessoryType = UITableViewCellAccessoryCheckmark;
      cell.tag=1;
      intValue=cell.tag;
      NSLog(@"Tag %d",intValue);
  }
  else
  {
      cell.accessoryType = UITableViewCellAccessoryNone;
      cell.tag=0;
      NSLog(@"Tag %d",cell.tag);
  }
  return cell;
  }
  -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  CategoryCustumCell *cell = (CategoryCustumCell *)[tableView cellForRowAtIndexPath:indexPath];
  NSString *selectedCell= cell.categoryLabel.text;
  NSLog(@"Selected Cell Value %@",selectedCell);
  
  NSNumber *obj = [NSNumber numberWithInteger:indexPath.section];
  if ([SelectedRows containsObject:obj])
  {
      [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
      [SelectedRows removeObject:obj];
      [tableView reloadData];
  }else{
      [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
      [SelectedRows addObject:obj];
      [tableView reloadData];
  }
  
  NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults];
  [userDef setObject:SelectedRows forKey:@"SelectedRows"];
  [userDef synchronize];
  }
  </code></pre>
  
  <p>And i Pass this Tag Value in Url Like as</p>
  
  <pre><code>NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"http://www.janvajevu.com/webservice/insert_gcm.php?gcm_id=%@&amp; category1=%d&amp;category2=%d&amp;category3=%d&amp;category4=%d&amp;category5 =%d&amp;category6=%d&amp;category7 =%d&amp;category8=%d&amp; category9=%d",uniqueIdentifier,intValue,intValue,intValue,intValue,intValue,intValue,intValue,intValue,intValue]];
  </code></pre>
  
  <p>Here i want tag Value <code>1</code> if cell was Selected and tag Value <code>0</code> if cell is not selected Please Give me Solution for it </p>