Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6025493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:18:32+00:00 2026-05-23T04:18:32+00:00

I am having Tableview which shows comments on facebook post. I am getting comments

  • 0

I am having Tableview which shows comments on facebook post. I am getting comments in Array and comments Id in second array ..I have taken one uibutton in tableview cell. on that button I want to get comment id of particular comment so that I can pass that id to like method..But It is always taking id Of last comment..How can I ID of comment on Button.tag property,, My code is :

    - (NSInteger)tableView:(UITableView *)atableView numberOfRowsInSection:(NSInteger)section {

        return [[facebook comments] count];
    }


    - (UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

        static NSString *CellIdentifier = @"Cell";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
        }

    like = [UIButton buttonWithType:UIButtonTypeRoundedRect];

        like.frame = CGRectMake(60, 70, 40, 20);

        [like setTitle:@"like" forState:UIControlStateNormal];
        [like setTag:indexPath.row];
        [like addTarget:self action:@selector(likeComment) forControlEvents:UIControlEventTouchUpInside];

        [cell.contentView addSubview:like];

        ;


        cell.textLabel.font = [UIFont fontWithName:@"Arial" size:10.0];

        cell.detailTextLabel.font = [UIFont fontWithName:@"Arial" size:12.0];

        cell.textLabel.text = [[facebook commentId]objectAtIndex:indexPath.row];    

        cell.detailTextLabel.text = [[facebook comments]objectAtIndex:indexPath.row];

        NSLog(@"%@ person like this",[facebook likesCount] );


        NSLog(@"%@ person like this comment",[facebook commentLikes]);



        return cell;
    }

    - (void )likeComment {

        NSString *idStr = [NSString stringWithFormat:@"%@/likes",[[facebook commentId]objectAtIndex:like.tag]];



        [fbGraph doGraphPost:idStr withPostVars:nil];   

        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"You like this"
                                                       message:@"" delegate:nil
                                             cancelButtonTitle:@"Ok" otherButtonTitles:nil ];

        [alert show];
        [alert release];




}

Please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:18:33+00:00Added an answer on May 23, 2026 at 4:18 am

    The problem, which you are facing because you are always using the last like button.

    You require to make few changes, Append an in the function name like likeComment:.

        [like addTarget:self action:@selector(likeComment:) forControlEvents:UIControlEventTouchUpInside];
    

    And modify your likeComment method like below.

    - (void )likeComment:(id) sender {
    
            UIButton* myLikeButton = (UIButton*)sender;
            NSString *idStr = [NSString stringWithFormat:@"%@/likes",[[facebook commentId]objectAtIndex:myLikeButton.tag]];
    
    
    
            [fbGraph doGraphPost:idStr withPostVars:nil];   
    
            UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"You like this"
                                                           message:@"" delegate:nil
                                                 cancelButtonTitle:@"Ok" otherButtonTitles:nil ];
    
            [alert show];
            [alert release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am having a tableview in which custom cells are loaded.Custom cell has a
I am having trouble getting my UITableViewController to reload/refresh the data. I have a
I'll show you my problem by image. I have tableView in which i customize
I am having a custom 'tableview' implementation. I am implementing a feature which I
I am having difficulty in changing the image of my UIButton which is contained
I am having a tableView which lists the contents of a directory which includes
I am having a tableView which lists the contents directory which includes jpg, pdf,
I am having a tableView which lists the contents directory which includes jpg, pdf,
I'm having a problem. I have a Custom UITableViewCel, the cell contains a slider
I have a tableView which has a button to put it into a pseudoEditing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.