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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:35:12+00:00 2026-06-08T09:35:12+00:00

The normal way to open another screen from within a FirstVC screen, so one

  • 0

The normal way to open another screen from within a FirstVC screen, so one can close it again is like this:

    SecondVC *secondVC = [[SecondVC alloc] initWithNibName:@"SecondVC" bundle:nil];
    secondVC.delegate = self; //needed to dismiss
    [self presentModalViewController: secondVC animated: YES];

while the SecondVC.m has to import a protocol that declares the method called to close the SecondVC

So I always have to create a protocol file SecondVCProtocol.h which basically looks like this:

@protocol SecondVCProtocol <NSObject>
-(void)secondVCDidFinish;
@end

Then in SecondVC.m I need to import this SecondVCProtocol.h file and now can finally call

 [self.delegate    secondVCDidFinish]

I have just completed another Android app and beeing back in the iOS world, I find this rather cumbersome. – needing to define such a protocol in a separate file & needing to use a delegate – all just to do the most normal task like closing a screen…

Isn’t there an easier less complex way or is this just the way it has to be done?

for example like [self dismiss] in SecondVC – no delegate, no protocol – wouldn’t his be really nice?

Many thanks!

  • 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-08T09:35:15+00:00Added an answer on June 8, 2026 at 9:35 am

    You can just call

    dismissViewControllerAnimated:completion:
    

    on the presented viewcontroller, although it is not exactly best practice.

    From Apple’s documentation:

    The presenting view controller is responsible for dismissing the view
    controller it presented. If you call this method on the presented view
    controller itself, it automatically forwards the message to the
    presenting view controller.

    Also from Apple’s documentation though (http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html)

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

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

Sidebar

Related Questions

Is the normal way to do this to just make 2 cols in my
Is there a way to tune the Oracle client (InstantClient or the normal one)?
What is the best way within my PHP script to differentiate between a normal
The normal JSON approach looks something like this: { list: [ { header1: some
I would like to have opinions/suggestions whether this is a good way to implement/enhance
Normal way: class A: def __init__(self): self.a.b.c = 10 def another_method(self): self.a.b.c = self.a.b.c
In javascript, is there any different between these two: // call MyFunction normal way
Is it normal to have tests that are way bigger than the actual code
What is the most concise way of converting a java.util.List into a normal JavaFX
I'm looking for a way to determine the difference between two dates. A normal

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.