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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:17:07+00:00 2026-06-14T11:17:07+00:00

I have a TableView which describes a book with sections which represents the chapters

  • 0

I have a TableView which describes a book with sections which represents the chapters and rows representing the verses.

A the top of this TableView I have a button in a navigation bar to allow “navigation”.

The goal of this navigation button is to allow the user to easily jump to a given chapter/verse without scrolling manually (which can be very long).

When the button is pressed a tableview controller is called displaying all the available chapters of the book and when a chapter is selected another table view is called displaying a list of the available verses in the current chapter. Finally when the line is chosen the tablew view displaying the book should scroll to the given index/row.

So the idea : from the tableview representing the book I call the chapters view as modal and the verses as a push over the chapters view.

enter image description here

My problem is that I don’t get the point of managing the delegate and dismissing from the 2nd modal view.

With 1 modal view I do things like that.

In the displayed VC (View Controller) I added the protocol and the delegate

@protocol ChapitresTableViewControllerDelegate <NSObject>
- (void)didDismissPresentedViewController;
@end

@interface ChapitresTableViewController : UITableViewController
@property (nonatomic, weak) id <ChapitresTableViewControllerDelegate> delegate;
@end

I have in the didSelectRow

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.delegate didDismissPresentedViewController];
}

in the displaying VC I add the following line

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
  ChapitresTableViewController *chapitresTableViewController = segue.destinationViewController;
  chapitresTableViewController.delegate = self;
}

and of course

-(void)didDismissPresentedViewController
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

this would just work fine if I wanted to close after the first modal VC, but what I want is to have the second one being dismissed after I click in the second. Ok I can write the protocol and stuff in the second modal VC but how do I manage to have the delegate being send to the second VC.

Hope my question is clear enough it is not so easy to explain it.

Anyone understand me and can help me ?

NOTE : I know for now I don’t pass any parameters back to the delegate, which I will do later to do the scroll. For now I just want to be able to close the second view, then I will add the required stuff to pass the parameters back to the delegate

  • 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-14T11:17:08+00:00Added an answer on June 14, 2026 at 11:17 am

    I’m sure you can do this, but rather than modal view controllers with a navigation bar, wouldn’t it be easier to use a navigation controller? Then you can use popToViewController to go back as many levels as you want to a particular view controller. You can either pass the UIViewController* of the various controllers you might want to pop to, or do so programmatically: e.g. How to pop back to specify viewController from navigationController(viewControllers/stack)?

    In this scenario previous views controllers are retained. The ones you pop off are released (just like the modal ones you dismiss are released), but the ones that you pushed from are retained (just like the ones you presented from in a modal world are retained).

    If the book is large, though, you’ll have to be sensitive to memory usage. Thus, you will probably want to handle didReceiveMemoryWarning to release the model data for the previous views in either your modal sequence or push sequence, in which case, on viewDidAppear, you’ll want to see if your app had to release the memory in response to didReceiveMemoryWarning and reload it in that case. But that’s the desired behavior, either way, gracefully release the pages if needed (and reload them when the particular view reappears), but keep it in memory if you can.

    Finally, you might also want to contemplate using UIPageViewController. Given what you’ve described, I’d like consider UIPageViewController first, UINavigationController and push segues second, and the use of modal segues third.

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

Sidebar

Related Questions

I have a dynamic tableview which has a prototype cell with a button that,
I am creating a TableView which contains 20 rows.I have to add single labels
I have a tableview, which has many sections. each section has just one cell.
i have created a tableview in which we can add and delete rows. On
I have this tableview in my app which has a particular item name such
I have TableView which number of rows depends on the number of NSStrings in
I have a tableView which has a button to put it into a pseudoEditing
I have a TableView which has 2 sections and the 2nd section is only
I have a grouped tableview which I set its background like this in viewDidload;
I have a TableView in which I can scroll to view all the rows.

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.