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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:45:23+00:00 2026-06-17T04:45:23+00:00

I want an alert when the following text fields receive the conditions in second

  • 0

I want an alert when the following text fields receive the conditions in second section of code

self.circuit.rcdAtIan = [ICUtils nonNilString:self.rcdAtIan.text];
self.circuit.rcdAt5an = [ICUtils nonNilString:self.rcdAt5an.text];

The above code works fine so now I need to fire it. Using the below method was my first thought but that fires the alert on every keyboard resignation. I only want the alert to display once.

- (void)textFieldDidEndEditing:(UITextField *)textField {
    if ([_rcdAtIan.text intValue]> 200) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"my message" delegate:nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
        [alert show];     
    }

    if ([_rcdAt5an.text intValue]> 40) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"my message" delegate:nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
        [alert show];
    }
}

Im thinking maybe I need a bool with NSUserDefaults perhaps? but not sure how to implement that to check if the alert has been shown. Normally if I wanted an alert shown once I would do

 if (![@"1" isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:@"alert"]]){
    [[NSUserDefaults standardUserDefaults] setValue:@"1" forKey:@"alert"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    [alert show];

}

However in this instance, when the page is reloaded I want the alerts to be shown again and in any case im not sure if thats an efficient way to solve 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-06-17T04:45:24+00:00Added an answer on June 17, 2026 at 4:45 am

    Don’t use NSUserDefaults, that would be inappropriate

    in your @interface…

        @property (assign) BOOL freshAlert1;
        @property (assign) BOOL freshAlert2;
    

    then something like this… (assuming ‘page is reloaded’ equates to your viewController coming back onscreen)

    - (void)viewDidAppear
    {
         self.freshAlert1 = YES;
         self.freshAlert2 = YES;
    
    }
    
    if (([_rcdAtIan.text intValue]> 200) && self.freshAlert1) {
        self.freshAlert1 = NO;
        ...
       }
    
     if (([_rcdAt5an.text intValue]> 40) && self.freshAlert2) {
        self.freshAlert2 = NO;
    
         ...
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code (live: http://jsfiddle.net/xyZY8/1/ ): var str = '<div>hello</div><ul><li>Some text...</li>' + '<li>second
I have the following code where I want to show / hide different text
Let say I have the following code $(p).bind(click, function(){ alert( $(this).text() ); }); When
I want to get text from Nested SPAN element in Following HTML code: <span
I want to run following html/JS code in PhoneGap, but the alert dialog is
I have a JavaScript function code where I want to alert. function msgalert(x,y) {
I have a JavaScript function code where I want to alert. function msg(x,y) {
the following code gives me an alert with the selected value on page load
I want to be able to display the following code below only when a
Suppose I have the following HTML snippet: <input type=text id=myinput /> Now I want

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.