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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:50:22+00:00 2026-05-28T16:50:22+00:00

// self.wordTextField.text = @32; // self.wordTextField.text = [self.wordTextField.text lowercaseString]; // self.wordTextField.text = [self.wordTextField.text stringByReplacingOccurrencesOfString:@

  • 0
//  self.wordTextField.text = @"32";
//  self.wordTextField.text = [self.wordTextField.text lowercaseString];
//  self.wordTextField.text = [self.wordTextField.text stringByReplacingOccurrencesOfString:@" " withString:@"?"];

NSString *removeString = @"`1234567890-=~!@#$%^&*()_+[]\\{}|;':\",./<>";
NSMutableSet *removeSet = [NSMutableSet set];
for (unsigned i = 0; i < removeString.length; i++) {
    NSRange range; range.location = i; range.length = 1;
    NSString *char_ = [removeString substringWithRange:range];
    [removeSet addObject:char_];
}
for (unsigned i = 0; i < self.wordTextField.text.length; i++) {
    NSRange range; range.location = i; range.length = 1;
    NSString *thisLetter = [self.wordTextField.text substringWithRange:range];
    if ([removeSet containsObject:thisLetter]) {
        self.wordTextField.text = [self.wordTextField.text stringByReplacingOccurrencesOfString:thisLetter 
                                                                                     withString:@""];
        i--;
    }
}

The three commented lines all cause my method to enter an infinite loop, because self.wordTextField.text is inside a method that is called when editing is being changed, so obviously my setting the text property causes more editing to change, resulting in the loop. My question is: why doesn’t the .text setter within the loop and conditional statements cause this behavior? That part works perfectly as (a user) would expect…

  • 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-28T16:50:22+00:00Added an answer on May 28, 2026 at 4:50 pm

    The code again enters into a loop by calling your change callback multiple times but that is not an infinite loop because it eventually stops when all invalid characters are removed from the text. Note that, the setter inside the loop is not called if the text does not contain any characters to remove.

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

Sidebar

Related Questions

[[self mainFrame] loadHTMLString:@<html><body><link href='main.css' rel='stylesheet' type='text/css' /></body></html> baseURL:nil]; I am trying to load a
self.mood_scale = { '-30':Panic, '-20':'Fear', '-10':'Concern', '0':'Normal', '10':'Satisfaction', '20':'Happiness', '30':'Euphoria'} I need to set
Since self-explaining text didnt work, I will make it 50 times shorter. I'm on
Self-Explanatory. In PHP, the solution would be to set the cookie expiration to 0;
self::$currentend = $cfp; self::$currentend = &$cfp->next; self::$basisend = $cfp; self::$basisend = &$cfp->bp; What does
self.response.out.write(\n) When i upload a data of multiline using text property and then printing
Pretty self explanatory, I just want to set up sublime to use 2 space
Pretty self-explanatory. Whenever I set the contents of a label, any spaces at the
self.navigationController.navigationBar.tintColor = [UIColor blackColor]; UILabel *header = [[UILabel alloc] initWithFrame:CGRectMake(100, 0, 320, 10)]; header.text
Pretty self-explanatory. I want to just have the combo box without any text outside

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.