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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:58:46+00:00 2026-05-30T05:58:46+00:00

I have a viewcontroller(say A). I am pushing some viewcontrollers over the first viewcontroller(A).

  • 0

I have a viewcontroller(say A). I am pushing some viewcontrollers over the first viewcontroller(A). After some tasks, I am switching back to my first view controller(A). That is, I pop to rootviewcontroller(A). But this time my viewcontroller(A) should have an alertview.

My question: Is setting a global boolean variable the right way to go in this case. I mean, I declare a global boolean variable which sets to true, only when the viewcontrollers are popped out. Is there a better way I could do 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-30T05:58:47+00:00Added an answer on May 30, 2026 at 5:58 am

    Sure you may use Global NSString(or BOOL) for showing the AlertView when comes to ViewController
    Here in Below code i used the String variable.
    Declare a NSString variable in AppDelegate.h Class

    NSString * checkAlert;
    //make property of that NSString.
    @property(retain,nonatomic)NSString * checkAlert;
    

    In AppDelegate.m

    //synthesize checkAlert
    @synthesize checkAlert;
    
    checkAlert=@"NotNeed";
    

    then in ViewController

    -(void)ViewWillAppear{
    // here check if checkAlert contains string as you want
    if(checkAlert isEqualToString:@"showAlert"){
     //here show the AlertView
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"AlerViewmessage" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    
        [alert show];
        [alert release];
    }
    }
    
    //when you abou to navigate to another ViewController the Access that checkAlert String    as
    -(void)goToAnotheViewController{
    AppDelegate* appdele=(AppDelegate*)[[UIApplication sharedApplication]delegate];
    appdele.checkString=@"showAlert";
    
    //then navigate to viewController
    [self.navigationController pushViewController: animated:YES];
    }
    
    //you just need to compare checkString's value string . 
    

    It’ll work

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

Sidebar

Related Questions

Lets say I have a view, myView, a view controller, myViewController, and some sort
Let's say I have a PHP Model-View-Controller framework that maps an address like http://example.com/admin/posts/edit/5
Let's say I have a ViewController that needs access to a view. In the
I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when
I am having an issue pushing my view controller from a tableview that was
I have a long View Controllers hierarchy; in the first View Controller I use
Let's say I have a viewcontroller ViewBViewController. In that viewcontroller I create an instance
Let's say for instance that I have a UIPickerView in my ViewController . Upon
Hey all... I have a view controller (A) which on some action, alloc init's
Let's say we have a view controller with one sub view. the subview takes

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.