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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:34:33+00:00 2026-06-17T12:34:33+00:00

i use presentModalViewController to show some controller. A controller://it will show controller of B

  • 0

i use presentModalViewController to show some controller.

A controller://it will show controller of B and receive a message ,when it receive the Message,i want to kown the B is it show or not?

-(void)viewDidLoad{

     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recvPushMessage:) name:RECV_PUSH_MESSAGE_NOTIFY object:nil];

}
-(void)buttonAction(id)sender{
     B* b = [B alloc] init];
     UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:(UIViewController*)b];
     [self presentModalViewController:navigationController animated:YES];
     //release 
}
-(void)recvPushMessage{
   //i want to kown B is it show or not
   if(b is showing){
      //do something
   }
   else{
      //do something for A
   }

}

B controller://when B was show ,i do not want call recvPushMessage in A.

 -(void)viewDidLoad{

     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recvPushMessage:) name:RECV_PUSH_MESSAGE_NOTIFY object:nil];

}
-(void)recvPushMessage{

   //do something for B
}
  • 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-17T12:34:33+00:00Added an answer on June 17, 2026 at 12:34 pm

    Check if this is what you are looking for,

    -(void)recvPushMessage{
    
       if (self.presentedViewController) { //check if you have this model view controller
          //do something
       }
       else{
          //do something for A
       }
    }
    

    For version < iOS 5.0, you can use self.modalViewController.

    Update:
    For your second question, you can get the topViewController of navigation controller and compare it with C. You can use something like [self.modalViewController topViewController] to check if it is C and then proceed.

    For eg:-

    if ([[(UINavigationController *)self.modalViewController topViewController] isKindOfClass:[C class]])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use presentModalViewController to show ABPeoplePickerNavigationController. But the modal controller appears in
I want to persent a modalwindow, I use the PresentModalViewController and set the ModalPresentationStyle
Why do I want to use presentModalViewController in AppDelegate? - Processing didReceiveLocalNotification, so I
to show a modal uiview out of my mainView I use: [self presentModalViewController:myController animated:YES];
Use Case Show a photo uploaded by the user in a square box with
use C#,want to upload excel file on google doc. bellow syntax use to upload
My app flow requires Navigation and TabBar controller. So I decided to use TabBar
i'm developing an app for iphone, and i use [self presentModalViewController:aViewControllerInitializateBefore animated:YES]; Can you
I use the code below to insert data into my sqlite-database but for some
I am trying to show an MFMessageComposeViewController with the following code: controller = [[MFMessageComposeViewController

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.