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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:57:11+00:00 2026-05-31T14:57:11+00:00

I have two programmatically created buttons you can see in my viewDidLoad method. On

  • 0

I have two programmatically created buttons you can see in my viewDidLoad method. On the modal window I have a button that calls the cancelSearch method via a delegate. When I place a breakpoint on my cancelSearch method it is hit, so I know my delegate is set up correct, but even though it calls this line [self dismissViewControllerAnimated:YES completion:nil]; it’s not actually closing the modal window.

The code below is all from my main controller view.

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIBarButtonItem *actionButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self  action:@selector(showActionMenu:)];
    actionButton.style = UIBarButtonItemStyleBordered;

    UIBarButtonItem *searchButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self  action:@selector(showSearchMenu:)];
    searchButtonItem.style = UIBarButtonItemStyleBordered;

    UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 103.0f, 44.01f)];
    NSArray* buttons = [NSArray arrayWithObjects:actionButton, searchButtonItem, nil];
    [toolbar setItems:buttons animated:NO];
    self.navigationItem.title = @"Census Management";
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:toolbar];


    [[RKClient sharedClient] get:@"censusmanagement" delegate:self]; 
}

- (IBAction)showActionMenu:(id)sender
{
    [self performSegueWithIdentifier: @"CMActionSegue" sender: self];
}

- (IBAction)showSearchMenu:(id)sender
{
    ehrxCMSearchView *search = [[self storyboard] instantiateViewControllerWithIdentifier:@"cmSearch"];
    search.selectedOptions = self.selectedOptions;

    search.delegate = self;

    [self.navigationController pushViewController:search animated:YES];
}

- (void)cancelSearch:(ehrxCMSearchView *)controller
{
    [self dismissViewControllerAnimated:YES completion:nil];
}
  • 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-31T14:57:13+00:00Added an answer on May 31, 2026 at 2:57 pm

    You would dismiss a modal view using something similar to:

    [self dismissModalViewControllerAnimated:YES];
    

    This will dismiss the modal view which was loaded using something similar to:

    [self presentModalViewController:search animated:YES];
    

    However looking at your code snippet, it appears the search view controller is being pushed onto the navigation stack using the following line:

    [self.navigationController pushViewController:search animated:YES];
    

    So I you probably need to pop the view from the navigation stack rather than trying to dismiss it as a modal view:

    [self.navigationController popViewControllerAnimated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a two simple IceFaces buttons created this way. (I don't use xhtml
I have created a UIButton programmatically that correctly changes background color as desired when
I have two TableLayout widgets, created programatically in my Activity's onCreate() method. Table1: SomeTextCell1
I have two views which are created programmatically. Let's name them view1 and view2.
I have two activities that both contain an identical context menu built programmatically using
I have two applications written in Java that communicate with each other using XML
I have two webapplication, one is a simple authenticationsite which can authenticate the logged
So I basically have two subviews within my main view. I created each subview
I set views programmatically. Here is how I do that. Let's say I have
I have several NSComboBoxes created in Interface Builder, and one created programmatically. The NSComboBoxes

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.