Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return result.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath : indexPath];
- if (!(cell == nil)) {
- name = (UILabel *)[cell viewWithTag:10];
- name.text = [result objectAtIndex : indexPath.row];
- }
- name.tag=indexPath.row;
- return cell;
- }
- - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- return YES;
- }
- - (IBAction)action:(id)sender {
- [_myTableView setEditing:YES animated:YES];
- }
- - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return UITableViewCellEditingStyleDelete;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath : indexPath];
- if (!(cell == nil)) {
- name = (UILabel *)[cell viewWithTag:10];
- name.text = [result objectAtIndex : indexPath.row];
- }
- name.tag=indexPath.row;
- return cell;
- }
- - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- return YES;
- }
- - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
- [result removeObjectAtIndex:indexPath.row];
- [tableView reloadData];
- [spinner startAnimating];
- NSString *id = [profile objectForKey:@"user_id"];
- NSString *tb =tid;
- NSString *string = [NSString stringWithFormat:@"userid=%@&topiid=%@",id,tb];
- NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"myDeleteUrl"]];
- NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
- [request setHTTPMethod:@"POST"];
- [request setHTTPBody : data];
- NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration
- NSDictionary *JSON= [NSJSONSerialization JSONObjectWithData :data options :NSJSONReadingMutableContainers error
- NSArray *alertArray = [JSON objectForKey:@"deletebookmark"];
- for (NSDictionary *alert in alertArray ){
- if ([[alert objectForKey:@"status"] isEqualToString:@"done"]) {
- NSLog(@"done");
- [spinner stopAnimating];
- }
- else{
- NSLog(@"notDone");
- [spinner stopAnimating];
- }
- }
- }]resume];
- }
- }*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement