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 8410963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:18:59+00:00 2026-06-10T00:18:59+00:00

This topic has been covered over and over, but after two days of researching

  • 0

This topic has been covered over and over, but after two days of researching and trying all of the solutions suggested, I still can’t do what I want.

First of all, I’m creating an app for iOS 5, using storyboard.

I have a UITableViewController, with 2 types of cell (an original “message”, and a number of “answers” to it). I created my table in my storyboard, checked “prototypes cells”, designed 2 cells with my 2 or 3 labels, a textView, and an image. Then, I subclassed UITableViewCell with 2 new classes, which I called ThreadAlertCell and ThreadAnswerCell. I created properties for my cell’s elements, so I can set the text of the labels and the image programmatically. I linked my graphic elements to their definition in the storyboard as usual. In my TableViewController, in cellForRowAtIndexPath, I create the cells and populate them. So far so good, everything is displayed correctly and how I want it.

But, I want a “touch” on the image of a cell, to pop a new view, showing the user’s profile page (an other basic view, I can do it with performSegue, no problem for that).

I have tried so many things I’m not sure it’s very useful to put everything in detail here. While looking for answers, I understood that using a UIImageView when you expect to handle gestures is not really the best way. So I changed it to a UIButton. But I can’t get the touch event to do anything !

I’ll give only the example of an “answer” cell.

Here is my ThreadAnswerCell header file (I won’t give the .m, nothing interesting there) :

@interface ThreadAnswerCell : UITableViewCell

@property (nonatomic) IBOutlet UILabel *senderLabel;
@property (nonatomic) IBOutlet UILabel *dateLabel;
@property (nonatomic) IBOutlet UITextView *contentTextView;
@property (nonatomic, weak) IBOutlet UIButton *senderButton;

@end

And here is half the cellForRowAtIndexPath from my TableViewController (I do the same for the “message” before that) :

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"ThreadAnswerCell";
    ThreadAnswerCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    if (cell == nil) {
        cell = [[ThreadAnswerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }

    Message *message = [threadArray objectAtIndex:indexPath.row];

    cell.senderLabel.text = [NSString stringWithFormat:@"%@", message.sender];
    cell.contentTextView.text = [NSString stringWithFormat:@"%@", message.content];
    cell.dateLabel.text = [NSString stringWithFormat:@"%@", message.date];
    //[cell.senderButton setBackgroundImage: [[UIImage alloc] initWithData: [NSData dataWithBase64EncodedString: message.userPic]]
    //                             forState: UIControlStateNormal];

    [cell.senderButton addTarget:self action:@selector(firstButtonSelected:) forControlEvents:UIControlEventTouchUpInside];

    CGRect frame = cell.contentTextView.frame;
    frame.size.height = cell.contentTextView.contentSize.height;
    cell.contentTextView.frame = frame;
    [cell.contentTextView sizeToFit];

    return cell;
}

As you can see, I use my custom cell, then populate it with content (I use three useless stringWithFormat but I have my reasons, lol), and I try to add an event to my button. I also commented the part where I set the button’s background image to “see” the button on my screen.

And here is the method I want the buttons to call :

- (void)firstButtonSelected: (id)sender
{
    NSLog(@"hello");
}

But, the method is never called ! Any ideas on where I’ve gone wrong or any other working solution would be great ! Thanks.

  • 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-06-10T00:19:01+00:00Added an answer on June 10, 2026 at 12:19 am

    Do you have
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

    Implemented in your tableview delegate class?

    I think, your cell catches the touch events. Try to delete the method. And
    cell.selectionStyle = UITableViewCellSelectionStyleNone

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It appears this topic has been covered a few times before, but those solutions
This topic has been covered on this forums, but I haven't found a working
I know this topic has been asked, but the posts are all out of
This topic has been covered in one form or another but none of the
I know this topic has been discussed and killed over and over again, but
This topic has been discussed several times on the web but all subjects none
I am aware that this topic has been covered already in many places, but
I've been trawling through all the suggested posts for this topic but can't seem
This topic has been scratched once or twice, but I am still puzzled. And
I know this topic has been discussed but I think it has some differences.

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.