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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:13:52+00:00 2026-05-12T15:13:52+00:00

In my application i create a custom Numberpad .How can i delete whole contents

  • 0

In my application i create a custom Numberpad .How can i delete whole contents of the textfield on continuos tap on the clear button. Any idea?

  • 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-12T15:13:53+00:00Added an answer on May 12, 2026 at 3:13 pm

    This was a fun one.

    Basically what I did was write a method to pull the last character out of the textField’s text String.

    I added another method to be fired on the Button’s touchDown event, which first calls the method to erase the last character and then starts a timer to start repeating. Because the delay before repeating (at least on the native keyboard) is longer than repeat delay, I use two timers. The first one’s repeat option is set to NO. it calls a method that starts a second timer that repeats to call the erase last character method repeatedly.

    In addition to the touchDown event. We also register for the touchUpInside event. When fired it calls a method that invalidates the current timer.

        #import <UIKit/UIKit.h> 
    
        #define kBackSpaceRepeatDelay 0.1f
        #define kBackSpacePauseLengthBeforeRepeting 0.2f
    
        @interface clearontapAppDelegate : NSObject <UIApplicationDelegate> {
            UIWindow *window;
            NSTimer *repeatBackspaceTimer; 
            UITextField *textField;
        }
    
        @property (nonatomic, retain) IBOutlet UIWindow *window;
        @property (nonatomic, retain) NSTimer *repeatBackspaceTimer;
    
        @end
    
        @implementation clearontapAppDelegate
    
        @synthesize window, 
        @synthesize repeatBackspaceTimer;
    
        - (void)applicationDidFinishLaunching:(UIApplication *)application {    
            textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 40, 300, 30)];
            textField.backgroundColor = [UIColor whiteColor];
            textField.text = @"hello world........";
    
            UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
            button.frame = CGRectMake(10, 80, 300, 30);
            button.backgroundColor = [UIColor redColor];
            button.titleLabel.text = @"CLEAR";
    
            [button addTarget:self action:@selector(touchDown:) forControlEvents:UIControlEventTouchDown];
            [button addTarget:self action:@selector(touchUpInside:) forControlEvents:UIControlEventTouchUpInside];
            // Override point for customization after application launch
    
    
            [window addSubview:textField];
            [window addSubview:button];
            window.backgroundColor = [UIColor blueColor];
            [window makeKeyAndVisible];
        }
    
    
        -(void) eraseLastLetter:(id)sender {
            if (textField.text.length > 0) {
                textField.text = [textField.text substringToIndex:textField.text.length - 1];
            }
        }
    
        -(void) startRepeating:(id)sender {
            NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:kBackSpaceRepeatDelay
                                                              target:self selector:@selector(eraseLastLetter:)
                                                            userInfo:nil repeats:YES];
            self.repeatBackspaceTimer = timer;
        }
    
        -(void) touchDown:(id)sender {
            [self eraseLastLetter:self];
            NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:kBackSpacePauseLengthBeforeRepeting
                                                              target:self selector:@selector(startRepeating:)
                                                            userInfo:nil repeats:YES];
            self.repeatBackspaceTimer = timer;
        }
    
        -(void) touchUpInside:(id)sender {
            [self.repeatBackspaceTimer invalidate]; 
        }
    
        - (void)dealloc {
            [window release];
            [super dealloc];
        }
    
        @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Excel 2003 I can access the collection Application.CommandBars to create custom toolbars using
Trying to get custom Done button in Utility Application Create new project in Xcode
What is the right way to create custom pgsql types for django application so
I need to create a custom application domain to work around a bug in
I want to create a custom alert view within my iOS application. For example,
hi i am trying to create a custom attribute for my MVC application so
I have a WPF application where I'd like to create a custom pop-up that
My application is trying to create custom objects from NSImage objects (coming from the
In my symfony application I would like to create custom php class. And access
My web application uses document.createEvent and event.initEvent to create custom events of the generic

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.