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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:44:35+00:00 2026-06-17T03:44:35+00:00

I am a new programmer to Objective-C. I use a storyboard in my app.

  • 0

I am a new programmer to Objective-C.

I use a storyboard in my app. It contains UITableViewController.

When I click it is cell using segue go to next view controller. But I want to use -(void)onLongPress:(UILongPressGestureRecognizer*) pGesture and show another ViewController by using the same cell.

My TableView shows Companies. I want to show company details according to cell LongClick.

  • 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-17T03:44:37+00:00Added an answer on June 17, 2026 at 3:44 am

    You need to create a UILongPressGestureRecognizer.

    Then you need to attach it to the view that you wish to recognise the longPress.
    When you attach it you define an action selector and a target. The action selector is a method that will be trigged in the target when the gesture is recognised.

    Assuming you create the gesture recogniser in your tableViewController and that is also the target then it would look something like this

    UILongPressGestureRecognizer* longPGR =
    [[UILongPressGestureRecognizer alloc] initWithTarget:self
                                                  action:@selector(onLongPress:)];
    [self.relevantViewInTableViewCell addGestureRecognizer:longPGR];
    

    then you create an action method to intercept the taps

    -(void)onLongPress:(UILongPressGestureRecognizer*)pGesture
    {
        //statement
    }
    

    If you are creating your table with dynamic cells, your longPGR creation should take place when you create the cell.

    If you have static cells, you can make IBOutlet @properties connected to the cells concerned, and use that property in your longPGR creation.

    To show the other viewController, it is not necessary to use a segue. You can push the new viewController onto the NavigationController’s stack in the longPress method:

    [self.navigationController pushViewController:newViewController];
    

    That has the same effect as using a segue.

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

Sidebar

Related Questions

resize a image in table view cell... i am new programmer by this code
I am a new Programmer in Iphone... i wants use facebook in my app..and
Possible Duplicate: C++: When to use References vs. Pointers I'm pretty new programmer to
I'm a new Python programmer who is having a little trouble using 'self' in
I'm relatively new to Objective-C (mainly using cocoa/apple foundation framework), but a long-time C++
I am new programmer in objective c. I want to create Download directory inside
I am a new programmer of Iphone Application. I work dynamically not use nib
I am a new programmer... i have following problem.. Terminating app due to uncaught
I am a new Objective-C programmer coming from a C#, VB.NET, Etc. These are
I'm new with Objective C and am not an uber programmer anyway but one

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.