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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:26:48+00:00 2026-05-21T00:26:48+00:00

This one is probably something simple, still learning the ins-and-outs on this but I’ve

  • 0

This one is probably something simple, still learning the ins-and-outs on this but I’ve run out of searches for this one with no available answer.

I’ve got a UIViewController with several elements displayed on it, one such element is a UITableView. The UITableView has it’s own class and is allocated in the UIViewControllers viewWillAppear

- (void)viewWillAppear:(BOOL)animated
{
    UITableView *insideTableView = [[UITableView alloc] init];
    tableView.delegate = insideTableView;
    tableView.dataSource = insideTableView;
}

Everything is working fine in regards to the tableview. Today I am experimenting with a few additions, one of which is a new view popup on cell selection within that tableview.

Inside my TableView Class, I have the following:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Cell Pressed, Present View");
    PopupView *popupView = [[PopupView alloc] initWithNibName:@"PopupView" bundle:nil];
    popupView.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:popupView animated:YES];
}

Now it gets called fine, verified by the NSLog, however the view doesn’t appear. I know the problem is related to the fact that I want PopUp to appear over the TableViews Parent rather than itself.

I’m just not sure how to properly call it in this instance.

  • 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-21T00:26:48+00:00Added an answer on May 21, 2026 at 12:26 am

    The delegate is a UIViewController which doesn’t have its view property set, which is why presentModalViewController:: doesn’t work.

    You need the view controller containing the table view to present the modal view controllers, but note that that view controller is not the parent of the table view delegate. This is because you have no view controller hierarchy in place.

    The easiest way to fix this is to put those methods inside the view controller whose view contains the table view. Alternatively the table view delegate needs to hold a reference to the view controller so it can call presentModalViewController:: on it.

    The latter approach can lead to retain cycle, so you have to use a non-retaining reference. The nicest implementation is the delegate pattern.

    Also, you don’t want to do the instantiation in viewWillAppear: because that can be called multiple times during the lifecycle of a view controller. Put the code in viewDidLoad and balance it in dealloc. Right now you are leaking memory every time your view appears, which when your modal view controller is working will be every time the modal view controller is presented and dismissed.

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

Sidebar

Related Questions

This is probably a simple one but I can't seem to figure it out.
Probably a really simple one this - I'm starting out with C# and need
This is probably a simple one to answer, but I'm stuck, so here goes.
I think this is probably something simple, but after an hour of searching, I've
This is probably something very simple but I'm not getting the results I'm expecting.
This is one of those I probably should know this, but I don't questions.
This is probably a basic html/css question... I have a simple one-button form that
Morning y'all This is probably an easy one but I barely got any sleep
Keeping the old question. See below for resolution. It is probably something simple, but
This is probably really obvious and simple - but it isn't to me with

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.