iPhone – Replication Paste to Restrict Strings in Digital Text Fields

I have a text box and I want the user to only enter numbers. I implemented a numeric keypad there. However, if someone puts my app in the background and copy from other apps Some string and return to my application and paste it, it will successfully paste the string content into my numeric text field. How can I limit this situation?
@theChrisKent is very close, but there is a better way. Use the delegate method -textView:shouldChangeTextInRange:replacementText:. Check if replacementText contains any non-digits, and if it is, return NO.

I have a text box and I want the user to enter only numbers. I implemented a numeric keypad there. However, if Someone put my app in the background and copy some string from other app and return to my app and paste it, it will successfully paste the string content into my digital text field. How can I restrict This situation?

@theChrisKent is very close, but there is a better way. Use the delegate method -textView: shouldChangeTextInRange: replacementText:. Check whether the replacementText contains any non-digits, if it is, then Return NO.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1074 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.