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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:45:38+00:00 2026-06-03T14:45:38+00:00

I am using code to check if a word is in my array, if

  • 0

I am using code to check if a word is in my array, if it is I want it to submit it and I have the code for it. If it isn’t I want it to pop up a screen. now this all works, the only thing is the screen pops up 2 times, because there are 2 words in my array. here is the code to explain it a little better.

NSArray *searchContacts = [NSArray arrayWithObjects:
                           @"CADEAU",
                           @"KADERZ",nil];
NSString *myContact = labelsText.text;

for (NSString *contact in searchContacts) {
    if ([contact isEqualToString:myContact]) {

this is where I put in my words, CADEAU & KADERZ in this case. When I put one of these words into labelsText.text it does exactly what I want. but for the else statement if the labels text.text word is not CADEAU or KADERZ, it pop ups a screen:

else {
 UIAlertView *alert = [[UIAlertView alloc]

This screen will pup up 2 times now, so i’ll have to press dismiss 2 times, how would I fix this to just have to press dismiss one time no mather how many words are in the array?

  • 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-03T14:45:39+00:00Added an answer on June 3, 2026 at 2:45 pm

    Put a break; after the code showing your alert:

    for (NSString *contact in searchContacts) {
        if ([contact isEqualToString:myContact]) {
            // do something
        } else { 
            // show screen
            break;
        }
    }
    

    This will ‘break’ out of the loop.

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

Sidebar

Related Questions

I am using this code to check that array is present in the HashMap
i am using this code to check if my glsl shader compiled fine. glGetObjectParameterivARB(obj,
Ok I am using Sonar to check code quality. It's telling me this simple
We are using ankhsvn to check in our .net code, however I have two
right now i m using this code for playing youtube videos <?php // Replace
I am using following code to check whether a check box on my website
I add many check boxes to the excel sheet programaticaly using the following code:
I love using irb to quickly check how my ruby code reacts. Im wondering
I'm using curl in PHP to check the HTTP code when requesting some files,
Does anyone know how to check in the code to Visual svn server using

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.