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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:07:50+00:00 2026-05-22T15:07:50+00:00

I have a UIViewController (MyViewController) and another view controller i’m presenting modally though MyViewController

  • 0

I have a UIViewController (MyViewController) and another view controller i’m presenting modally though MyViewController (call it SecondViewController). I want to be able to send a message to MyViewController from SecondViewController by using

[self.parentViewController hideSecondViewController];

But since parentViewController is defined as a UIViewController, and hideSecondViewController isn’t a method of UIViewController, I get a warning saying “UIViewController may not respond to ‘hideSecondViewController'”. It works fine, because it CAN send the message successfully during the program, but since I #import SecondViewController in MyViewController, I can’t #import MyViewController in SecondViewController. Any way around this?

  • 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-22T15:07:50+00:00Added an answer on May 22, 2026 at 3:07 pm

    When it comes time to dismiss a modal
    view controller, the preferred
    approach is to let the parent view
    controller do the dismissing. In other
    words, the same view controller that
    presented the modal view controller
    should also take responsibility for
    dismissing it whenever possible.
    Although there are several techniques
    for notifying a parent view controller
    that it should dismiss its modally
    presented child, the preferred
    technique is delegation.

    In a delegate-based model, the view
    controller being presented modally
    must define a protocol for its
    delegate to implement. The protocol
    defines methods that are called by the
    modal view controller in response to
    specific actions, such as taps in a
    Done button. The delegate is then
    responsible for implementing these
    methods and providing an appropriate
    response. In the case of a parent view
    controller acting as a delegate for
    its modal child, the response would
    include dismissing the child view
    controller when appropriate.

    Read more at the View Controller Programming Guide for iOS.


    P.S:

    since I #import SecondViewController
    in MyViewController, I can’t #import
    MyViewController in
    SecondViewController.

    To solve a circular dependency problem you can use a forward declaration.

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

Sidebar

Related Questions

Let's say I have a simple view controller with one UITableView property: @interface MyViewController
I have a .h file containing... myViewController : UIViewController {} in the .m file
I have created a UIViewController class called MyViewController with a UIImageView in its XIB
I want to use a modal view ( UIViewController ) as a normal view,
I have a UIViewController that is being pushed via a UINavigationViewController. The viewController's view
I have an UIViewController which contains a UITableView (subclassed) and another UIView (subclassed). They
So say in my viewcontroller's .h file I have: @interface MyViewController : UIViewController {
I have a UIViewController that manages the display of some data. When the user
I have an application with 5 UIViewController s each inside a corresponding UINavigationController ,
I have a UINavigationController containing an UIViewController initialized with a UIView. The UINavigationController also

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.