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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:35:25+00:00 2026-06-13T13:35:25+00:00

In my MainViewController , I present another view controller through this: MessageViewController *messageController =

  • 0

In my MainViewController, I present another view controller through this:

MessageViewController *messageController = [[MessageViewController alloc]initWithNibName:nil bundle:nil];

[messageController setModalPresentationStyle:UIModalPresentationFullScreen];
[messageController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

[self presentViewController:messageController animated:YES completion:nil];

[messageController release];

This will display the view controller correctly. However, when I try to go back to the presenting view controller, which in this case should be the MainViewController, this code doesn’t work:

if ([self.presentingViewController isKindOfClass:[MainViewController class]])
    [(MainViewController *)self.presentingViewController setCurrentViewTag:2];

[self dismissModalViewControllerAnimated:YES];

I removed the “if..” condition to force it in setting the current view tag. An error occurred telling me that the presenting view controller seems to be the UINavigationController:

[UINavigationController setCurrentViewTag:]: unrecognized selector sent to instance 0x8352a50

Can anyone tell me why is this happening? This code used to work before and I am not sure what changed to make it stop working properly.

EDIT

Here is the updated code:

ReaderController *readerController = [[ReaderController alloc]initWithNibName:nil bundle:nil];
[readerController loadWhichViewToShow:2];

[self setDefinesPresentationContext:YES];

[readerController setModalPresentationStyle:UIModalPresentationFullScreen];
[readerController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

[self presentViewController:readerController animated:YES completion:nil];

[readerController release];
  • 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-13T13:35:25+00:00Added an answer on June 13, 2026 at 1:35 pm

    Calling [self presentViewController:messageController animated:YES completion:nil]; doesn’t necessarily use the vc you call this on to present the other vc. By default it travels up the vc-hierarchy and presents the other vc on the root view controller. That’s why in your case the presenting view controller is a UINavigationController.

    If you want to force your MainViewController to be the presenting vc, you have call:

    [self setDefinesPresentationContext:YES];
    

    on your MainViewController before presenting the MessageViewController.

    Edit: In case someone else reads this: definesPresentationContext seems to be bugged or the documentation is wrong. See the comments below and Cocoa Builder

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

Sidebar

Related Questions

i have this MainViewController, which is a controller for my table view. Whenever I
In my MainViewController I am using this code: static NSBundle *bundle = nil; +(void)setLanguage:(NSString
Ok, so here's the situation. I currently have a view controller called MainViewController which
I need to present a modal view controller and be notified when it is
I am trying to present a view controller (a passcode request type view) every
Trying to present a modal view controller with the following code MapViewController *mapView =
I'm trying to present a Modal View Controller when the app enters in foreground..
I'm currently working on an app with this structure: I have a view controller
I have my MainViewController which a UIViewController class, in this view I have a
I have a MainViewController and i am Presenting another viewcontroller(2nd ViewController) through [self PresentModalViewControllerAnimated:YES];

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.