Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. *- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  2. return result.count;
  3. }
  4. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  5. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath : indexPath];
  6. if (!(cell == nil)) {
  7. name = (UILabel *)[cell viewWithTag:10];
  8. name.text = [result objectAtIndex : indexPath.row];
  9. }
  10. name.tag=indexPath.row;
  11. return cell;
  12. }
  13. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
  14. return YES;
  15. }
  16. - (IBAction)action:(id)sender {
  17. [_myTableView setEditing:YES animated:YES];
  18. }
  19. - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
  20. {
  21. return UITableViewCellEditingStyleDelete;
  22. }
  23.  
  24.  
  25. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  26. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath : indexPath];
  27. if (!(cell == nil)) {
  28. name = (UILabel *)[cell viewWithTag:10];
  29. name.text = [result objectAtIndex : indexPath.row];
  30. }
  31. name.tag=indexPath.row;
  32. return cell;
  33. }
  34. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
  35. return YES;
  36. }
  37.  
  38. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
  39.  
  40. [result removeObjectAtIndex:indexPath.row];
  41. [tableView reloadData];
  42. [spinner startAnimating];
  43. NSString *id = [profile objectForKey:@"user_id"];
  44. NSString *tb =tid;
  45.  
  46. NSString *string = [NSString stringWithFormat:@"userid=%@&topiid=%@",id,tb];
  47. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"myDeleteUrl"]];
  48.  
  49. NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
  50. [request setHTTPMethod:@"POST"];
  51. [request setHTTPBody : data];
  52. NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration
  53.  
  54. NSDictionary *JSON= [NSJSONSerialization JSONObjectWithData :data options :NSJSONReadingMutableContainers error
  55.  
  56. NSArray *alertArray = [JSON objectForKey:@"deletebookmark"];
  57.  
  58. for (NSDictionary *alert in alertArray ){
  59.  
  60. if ([[alert objectForKey:@"status"] isEqualToString:@"done"]) {
  61. NSLog(@"done");
  62. [spinner stopAnimating];
  63. }
  64. else{
  65. NSLog(@"notDone");
  66. [spinner stopAnimating];
  67. }
  68. }
  69.  
  70. }]resume];
  71.  
  72. }
  73. }*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement