<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>[iPhoneiOS dev:tips]; &#187; Undocumented</title>
	<atom:link href="http://iPhoneDeveloperTips.com/category/undocumented/feed" rel="self" type="application/rss+xml" />
	<link>http://iPhoneDeveloperTips.com</link>
	<description>Tips and Tricks for iPhone developers</description>
	<lastBuildDate>Wed, 25 Aug 2010 11:38:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adding Text Message to an ActionSheet</title>
		<link>http://iPhoneDeveloperTips.com/undocumented/adding-text-to-an-actionsheet.html</link>
		<comments>http://iPhoneDeveloperTips.com/undocumented/adding-text-to-an-actionsheet.html#comments</comments>
		<pubDate>Fri, 12 Dec 2008 06:18:06 +0000</pubDate>
		<dc:creator>John Muchow</dc:creator>
				<category><![CDATA[Undocumented]]></category>

		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1225</guid>
		<description><![CDATA[The ActionSheet supports one line of text, the title, which as the name implies, is displayed across the top of the Alert. See the image below for an example. There is an undocumented method that you can call to add another line of text just below the title. The setMessage method accepts an NSString and [...]]]></description>
			<content:encoded><![CDATA[<p>The ActionSheet supports one line of text, the title, which as the name implies, is displayed across the top of the Alert. See the image below for an example.</p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2008/12/homebrew1.png"/><br />
<span id="more-1225"></span></p>
<p>There is an undocumented method that you can call to add another line of text just below the title. The <strong><em>setMessage</em></strong> method accepts an NSString and will display the text in a font slightly larger than the title.</p>
<p>What follows is a short example to create an ActionSheet with an additional message displayed.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;">UIActionSheet <span style="color: #002200;">*</span>options <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIActionSheet alloc<span style="color: #002200;">&#93;</span> 
          initWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;HomeBrewing Styles&quot;</span> 
          delegate<span style="color: #002200;">:</span>self
          cancelButtonTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;I Can't Decide&quot;</span>
          destructiveButtonTitle<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span>
          otherButtonTitles<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;English&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;American&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Imperial&quot;</span>, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>options setMessage<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Select a Style of IPA:&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>options showInView<span style="color: #002200;">:</span>self.view<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>The output of the code above is shown in the figure that follows.</p>
<p><img src="http://iPhoneDeveloperTips.com/wp-content/uploads/2008/12/homebrew2.png"/></p>
]]></content:encoded>
			<wfw:commentRss>http://iPhoneDeveloperTips.com/undocumented/adding-text-to-an-actionsheet.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Alert with TextFields</title>
		<link>http://iPhoneDeveloperTips.com/undocumented/alert-with-textfields.html</link>
		<comments>http://iPhoneDeveloperTips.com/undocumented/alert-with-textfields.html#comments</comments>
		<pubDate>Mon, 24 Nov 2008 07:08:09 +0000</pubDate>
		<dc:creator>John Muchow</dc:creator>
				<category><![CDATA[Undocumented]]></category>

		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1094</guid>
		<description><![CDATA[Note: Although applications in the App Store have used this approach, Apple has also rejected applications that use this technique as it does access private APIs. In a recent discussion with the UI designers for an upcoming iPhone application, I was asked if it&#8217;s possible to create an Alert that would overlay the splash screen, [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Note</strong>: Although applications in the App Store have used this approach, Apple has also rejected applications that use this technique as it does access private APIs.</em></p>
<p>In a recent discussion with the UI designers for an upcoming iPhone application, I was asked if it&#8217;s possible to create an Alert that would overlay the splash screen, prompting for a username and password.<br />
<span id="more-1094"></span></p>
<p>My original response (based on searching the documentation) was a regrettable, no. However, after some digging I did come upon an undocumented method inside the <strong>UIAlertView</strong>: <strong><em>addTextFieldWithValue</em></strong>. What follows is a screenshot of how you might use this feature:</p>
<p><img width=250" src="http://iPhoneDeveloperTips.com/wp-content/uploads/2008/11/alert-login.png"/></p>
<p>The code for the alert example follows. Notice how you can create a pointer to the <strong>UITextFields</strong> and modify its attributes, very cool.</p>
<p><strong>In the .h file</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;">UITextField <span style="color: #002200;">*</span>textfieldName;
UITextField <span style="color: #002200;">*</span>textfieldPassword;</pre></td></tr></table></div>

<p><strong>In the .m file</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>alertView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIAlertView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>alertView clickedButtonAtIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>buttonIndex
<span style="color: #002200;">&#123;</span>
  <span style="color: #11740a; font-style: italic;">// Clicked the Submit button</span>
  <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>buttonIndex <span style="color: #002200;">!=</span> <span style="color: #002200;">&#91;</span>alertView cancelButtonIndex<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
  <span style="color: #002200;">&#123;</span>
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Name: %@&quot;</span>, textfieldName.text<span style="color: #002200;">&#41;</span>;
    NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Name: %@&quot;</span>, textfieldPassword.text<span style="color: #002200;">&#41;</span>;
  <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
...
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> someMethod
<span style="color: #002200;">&#123;</span>
  UIAlertView <span style="color: #002200;">*</span>alert <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIAlertView alloc<span style="color: #002200;">&#93;</span> initWithTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Please Login&quot;</span> message<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span>
        delegate<span style="color: #002200;">:</span>self cancelButtonTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Cancel&quot;</span>  otherButtonTitles<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Submit&quot;</span>, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
&nbsp;
  <span style="color: #002200;">&#91;</span>alert addTextFieldWithValue<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> label<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;User Name&quot;</span><span style="color: #002200;">&#93;</span>;
  <span style="color: #002200;">&#91;</span>alert addTextFieldWithValue<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span> label<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Password&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
  <span style="color: #11740a; font-style: italic;">// Username</span>
  textfieldName <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>alert textFieldAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
  textfieldName.keyboardType <span style="color: #002200;">=</span> UIKeyboardTypeAlphabet;
  textfieldName.keyboardAppearance <span style="color: #002200;">=</span> UIKeyboardAppearanceAlert;
  textfieldName.autocorrectionType <span style="color: #002200;">=</span> UITextAutocorrectionTypeNo;
&nbsp;
  <span style="color: #11740a; font-style: italic;">// Password</span>
  textfieldPassword <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>alert textFieldAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span>;
  textfieldPassword.clearButtonMode <span style="color: #002200;">=</span> UITextFieldViewModeWhileEditing;
  textfieldPassword.keyboardType <span style="color: #002200;">=</span> UIKeyboardTypeNumbersAndPunctuation;
  textfieldPassword.keyboardAppearance <span style="color: #002200;">=</span> UIKeyboardAppearanceAlert;
  textfieldPassword.autocorrectionType <span style="color: #002200;">=</span> UITextAutocorrectionTypeNo;
  textfieldPassword.secureTextEntry <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
&nbsp;
  <span style="color: #002200;">&#91;</span>alert show<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><img  width=250" src="http://iPhoneDeveloperTips.com/wp-content/uploads/2008/11/mjaikualert.png"/></p>
]]></content:encoded>
			<wfw:commentRss>http://iPhoneDeveloperTips.com/undocumented/alert-with-textfields.html/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>
