<?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>Namazu Studios &#187; Objective C</title>
	<atom:link href="http://www.namazustudios.com/tag/objective-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.namazustudios.com</link>
	<description>Earth-shaking mobile games.</description>
	<lastBuildDate>Mon, 13 Jun 2011 23:10:13 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Custom Alert View for iOS4</title>
		<link>http://www.namazustudios.com/blog/customalertview/</link>
		<comments>http://www.namazustudios.com/blog/customalertview/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 19:02:49 +0000</pubDate>
		<dc:creator>keith</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[The Blog]]></category>
		<category><![CDATA[AlertView]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[obj-c]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://www.namazustudios.com/?p=232</guid>
		<description><![CDATA[A customizable alert view for iOS4.  Near API match for minimal code refactoring.  Comes with custom delegate as well.]]></description>
			<content:encoded><![CDATA[<p>Hi everyone!</p>
<div id="attachment_245" class="wp-caption alignright" style="width: 170px"><a href="http://www.namazustudios.com/wp-content/uploads/2010/07/Screen-shot-2010-07-27-at-12.30.54-PM.png" rel="shadowbox[post-232];player=img;"><img class="size-full wp-image-245     " style="margin-left: 15px;" title="Screen shot 2010-07-27 at 12.30.54 PM" src="http://www.namazustudios.com/wp-content/uploads/2010/07/Screen-shot-2010-07-27-at-12.30.54-PM.png" alt="CustomAlertViewSampleProject Screen Shot" width="160" height="240" /></a><p class="wp-caption-text">CustomAlertView Screen Shot</p></div>
<p>With some of the changes in iOS4, it has become more difficult to create UIAlertViews with UITextFields as subviews and have it look right.  So I went ahead and made a fully customizable alert view replica called CustomAlertView (clever huh?).</p>
<p>One thing I didn&#8217;t want to do was re-factor a bunch of my code, so I recreated most of the methods in UIAlertView based on the description of their functionality in the API.  Some of the names are slightly different, particularly in the CustomAlertViewDelegate.  I have attached a sample project that should show how to use it, but I&#8217;ll also paste it below.</p>
<p>Two things to note in the project are that I connected the UITextFields in Interface Builder and that I set the main view to be the RootViewController of the main window.  The code relies on being able to access the root view controller, you you need to make sure it is set.  Here&#8217;s an excerpt from how I did it in CustomAlertViewSampleAppDelegate.m. The sample project at the end of the post contains the complete source.</p>
<hr />
<p style="padding-left: 30px;">- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {</p>
<p style="padding-left: 30px;">// Override point for customization after application launch.</p>
<p style="padding-left: 30px;">// Add the view controller&#8217;s view to the window and display.<br />
 [window setRootViewController:viewController];<br />
 [window makeKeyAndVisible];<br />
 return YES;<br />
 }</p>
<hr />
<p>Also, be sure to get the images from the sample project as well if you want to use this as is.</p>
<p>I hope you find this useful!  Please let me know if you find any bugs or ways to clean this up!  Also, I didn&#8217;t include the animation to move the CustomAlertView up to make space for the keyboard, but I can if people want <img src='http://www.namazustudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Download: <a href="http://bit.ly/cOpySf">Custom Alert View Code and Sample</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.namazustudios.com/blog/customalertview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

