<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Adding Mask to UITextField</title>
	<atom:link href="http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/feed/" rel="self" type="application/rss+xml" />
	<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/</link>
	<description>This site talks about the many challenges on computer programming.</description>
	<lastBuildDate>Tue, 24 Apr 2012 11:08:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Sarah</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25528</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Thu, 03 Nov 2011 09:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25528</guid>
		<description>Thanks for great solution, I needed to use a different mask like the following:
 mask=@&quot;9 (999) 999 99 99&quot; and I was wondering about the changes I need to make to the code.
thanks again,</description>
		<content:encoded><![CDATA[<p>Thanks for great solution, I needed to use a different mask like the following:<br />
 mask=@&#8221;9 (999) 999 99 99&#8243; and I was wondering about the changes I need to make to the code.<br />
thanks again,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25527</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Tue, 01 Nov 2011 19:21:36 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25527</guid>
		<description>First of all thanks a lot for this snippet. I ill add a little functionality to work with spaces :

1 - add a flag to the begining of :

- (void)formatInput:(UITextField*)aTextField string:(NSString*)aString range:(NSRange)aRange

ej:
int flag =0;

2.

        if (! [regextest evaluateWithObject:_mask]) {
          set the flag to 1
        flag = 1;

3.
 in the
        if (aRange.location + 1 &lt; [self.mask length]) {

 set the _mask to
   _mask =  (temp ==1) ? [self.mask substringWithRange:NSMakeRange(aRange.location+1, 1)]:[self.mask substringWithRange:NSMakeRange(aRange.location-1, 1)];

First of all thanks a lot for this snippet. I ill add a little functionality to work with spaces :

1 - add a flag to the begining of :

- (void)formatInput:(UITextField*)aTextField string:(NSString*)aString range:(NSRange)aRange

ej:
int flag =0;

2.

        if (! [regextest evaluateWithObject:_mask]) {
          set the flag to 1
        flag = 1;

3.
 in the
        if (aRange.location + 1 &lt; [self.mask length]) {

 set the _mask to
   _mask =  (temp ==1) ? [self.mask substringWithRange:NSMakeRange(aRange.location+1, 1)]:[self.mask substringWithRange:NSMakeRange(aRange.location-1, 1)];

And voila!
works great

And voila!
works great</description>
		<content:encoded><![CDATA[<p>First of all thanks a lot for this snippet. I ill add a little functionality to work with spaces :</p>
<p>1 &#8211; add a flag to the begining of :</p>
<p>- (void)formatInput:(UITextField*)aTextField string:(NSString*)aString range:(NSRange)aRange</p>
<p>ej:<br />
int flag =0;</p>
<p>2.</p>
<p>        if (! [regextest evaluateWithObject:_mask]) {<br />
          set the flag to 1<br />
        flag = 1;</p>
<p>3.<br />
 in the<br />
        if (aRange.location + 1 &lt; [self.mask length]) {</p>
<p> set the _mask to<br />
   _mask =  (temp ==1) ? [self.mask substringWithRange:NSMakeRange(aRange.location+1, 1)]:[self.mask substringWithRange:NSMakeRange(aRange.location-1, 1)];</p>
<p>First of all thanks a lot for this snippet. I ill add a little functionality to work with spaces :</p>
<p>1 &#8211; add a flag to the begining of :</p>
<p>- (void)formatInput:(UITextField*)aTextField string:(NSString*)aString range:(NSRange)aRange</p>
<p>ej:<br />
int flag =0;</p>
<p>2.</p>
<p>        if (! [regextest evaluateWithObject:_mask]) {<br />
          set the flag to 1<br />
        flag = 1;</p>
<p>3.<br />
 in the<br />
        if (aRange.location + 1 &lt; [self.mask length]) {</p>
<p> set the _mask to<br />
   _mask =  (temp ==1) ? [self.mask substringWithRange:NSMakeRange(aRange.location+1, 1)]:[self.mask substringWithRange:NSMakeRange(aRange.location-1, 1)];</p>
<p>And voila!<br />
works great</p>
<p>And voila!<br />
works great</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wally</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25465</link>
		<dc:creator>Wally</dc:creator>
		<pubDate>Wed, 24 Mar 2010 18:29:33 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25465</guid>
		<description>Works, but needs to be &quot;if(_aRange.location + 1 &lt; [self.mask length]){&quot; on the first line... Thanks!</description>
		<content:encoded><![CDATA[<p>Works, but needs to be &#8220;if(_aRange.location + 1 &lt; [self.mask length]){&quot; on the first line&#8230; Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rogerio</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25459</link>
		<dc:creator>rogerio</dc:creator>
		<pubDate>Tue, 23 Mar 2010 23:20:09 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25459</guid>
		<description>To setup the mask you only need to call initWithMask as you did in your previous comment.</description>
		<content:encoded><![CDATA[<p>To setup the mask you only need to call initWithMask as you did in your previous comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wally</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25458</link>
		<dc:creator>Wally</dc:creator>
		<pubDate>Tue, 23 Mar 2010 15:54:27 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25458</guid>
		<description>Great thanks! Can you also post a short example of setting the mask? Just want to make sure I&#039;m setting it correctly.</description>
		<content:encoded><![CDATA[<p>Great thanks! Can you also post a short example of setting the mask? Just want to make sure I&#8217;m setting it correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rogerio</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25457</link>
		<dc:creator>rogerio</dc:creator>
		<pubDate>Tue, 23 Mar 2010 11:06:39 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25457</guid>
		<description>Is must make the proper changes in the code to get spaces working in masks, let me do it here and I&#039;ll update to code on blog post.</description>
		<content:encoded><![CDATA[<p>Is must make the proper changes in the code to get spaces working in masks, let me do it here and I&#8217;ll update to code on blog post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wally</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25456</link>
		<dc:creator>Wally</dc:creator>
		<pubDate>Tue, 23 Mar 2010 04:08:27 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25456</guid>
		<description>Is there a way to format with an embedded space like in the phone example above? Could you provide an example of what the mask looks like? Currently, I&#039;m initializing the mask in the viewDidLoad by:

[self initWithMask@&quot;(999) 999-9999&quot;];

The desire is to have it automatically insert the space after the &quot;)&quot; is inserted. For example, the area code is 213 and the phone number is 543-9876. As the user types in the digits, it formats as follows:
User types:    TextField Displays:
2                 (2
1                 (21
3                 (213
5                 (213) 5
4                 (213) 54
3                 (213) 543
9                 (213) 543-9
8                 (213) 543-98
7                 (213) 543-987
6                 (213) 543-9876</description>
		<content:encoded><![CDATA[<p>Is there a way to format with an embedded space like in the phone example above? Could you provide an example of what the mask looks like? Currently, I&#8217;m initializing the mask in the viewDidLoad by:</p>
<p>[self initWithMask@"(999) 999-9999"];</p>
<p>The desire is to have it automatically insert the space after the &#8220;)&#8221; is inserted. For example, the area code is 213 and the phone number is 543-9876. As the user types in the digits, it formats as follows:<br />
User types:    TextField Displays:<br />
2                 (2<br />
1                 (21<br />
3                 (213<br />
5                 (213) 5<br />
4                 (213) 54<br />
3                 (213) 543<br />
9                 (213) 543-9<br />
8                 (213) 543-98<br />
7                 (213) 543-987<br />
6                 (213) 543-9876</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wally</title>
		<link>http://faces.eti.br/2010/02/19/adding-mask-to-uitextfield/comment-page-1/#comment-25455</link>
		<dc:creator>Wally</dc:creator>
		<pubDate>Mon, 22 Mar 2010 16:15:03 +0000</pubDate>
		<guid isPermaLink="false">http://faces.eti.br/?p=1013#comment-25455</guid>
		<description>Wow I&#039;ve been looking for sample code like this for a long time - thanks! Quick question: I&#039;m assuming this can be used for telephone number formatting as the user types in the number? I&#039;m looking for a way to format a telephone number similar to the built-in phone app, or similarly for entering phone numbers in contacts,  where it will format as (U.S. style phone#) ###-####, or if more numbers entered, eventually as (###) ###-####. Can the mask be variable like this, or will it need to be specified as the end-result (###) ###-####? Thanks!</description>
		<content:encoded><![CDATA[<p>Wow I&#8217;ve been looking for sample code like this for a long time &#8211; thanks! Quick question: I&#8217;m assuming this can be used for telephone number formatting as the user types in the number? I&#8217;m looking for a way to format a telephone number similar to the built-in phone app, or similarly for entering phone numbers in contacts,  where it will format as (U.S. style phone#) ###-####, or if more numbers entered, eventually as (###) ###-####. Can the mask be variable like this, or will it need to be specified as the end-result (###) ###-####? Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

