<?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>Rune&#039;s Blog &#187; tintColor</title>
	<atom:link href="http://runmad.com/blog/tag/tintcolor/feed/" rel="self" type="application/rss+xml" />
	<link>http://runmad.com/blog</link>
	<description>A blog about code, graphics, UI, marketing and whatever else interests me. Follow me on Twitter: @runmad</description>
	<lastBuildDate>Sat, 28 Jan 2012 14:08:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Colouring fun with moreNavigationController</title>
		<link>http://runmad.com/blog/2010/01/coloring-fun-with-morenavigationcontroller-and-it/</link>
		<comments>http://runmad.com/blog/2010/01/coloring-fun-with-morenavigationcontroller-and-it/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 16:03:40 +0000</pubDate>
		<dc:creator>Rune Madsen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[barStyle]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[morenavigationcontroller]]></category>
		<category><![CDATA[tintColor]]></category>
		<category><![CDATA[uitabbarcontroller]]></category>

		<guid isPermaLink="false">http://www.davesenior.com/rune/?p=95</guid>
		<description><![CDATA[When adding more than 5 view controllers to your UITabBarController, a &#8220;More&#8221; tab is automatically setup for you, which includes a view controller and even a modal view for letting the user edit the app&#8217;s tabs in the order they want. By default, the navigation bars for both the moreNavigationController and the modal view (edit) [...]]]></description>
			<content:encoded><![CDATA[<p>When adding more than 5 view controllers to your <em>UITabBarController</em>, a &#8220;More&#8221; tab is automatically setup for you, which includes a view controller and even a modal view for letting the user edit the app&#8217;s tabs in the order they want.</p>
<p>By default, the navigation bars for both the <em>moreNavigationController</em> and the modal view (edit) are the Default blue, but changing these colours isn&#8217;t exactly straightforward.</p>
<p>Here&#8217;s an example of what we want to achieve:</p>
<p><a href="http://runmad.com/blog/wp-content/uploads/2010/01/55780969-9ac509b43e33b4791a779eddd953138c.4b48a8ff-full1.png"><img class="aligncenter size-full wp-image-126" title="Custom colour in your moreViewController's navigation bar" src="http://runmad.com/blog/wp-content/uploads/2010/01/55780969-9ac509b43e33b4791a779eddd953138c.4b48a8ff-full1.png" alt="" width="414" height="770" /></a></p>
<p>I use an orange colour in one of my apps for the navigation bars and it just looks wrong when the more tab&#8217;s navigation bars are blue.</p>
<p>Changing the colour of the <em>moreNavigationController</em> is quite easy. After you alloc the <em>UITabBarController</em>, set the colour of the <em>moreNavigationController</em>:</p>
<div style="margin:0px 0px 20px;text-align:left;color:#000000; background-color:#F1EFE6; border: 1px solid rgb(211, 209, 199); padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">tabBarController.moreNavigationController.navigationBar.tintColor = [<span style="color:#400080;">UIColor</span> <span style="color:#6c0540;">orangeColor</span>];</div>
<p>You can also use the <em>barStyle</em> property if you like:</p>
<div style="margin:0px 0px 20px;text-align:left;color:#000000; background-color:#F1EFE6; border: 1px solid rgb(211, 209, 199); padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">tabBarController.moreNavigationController.navigationBar.barStyle = <span style="color:#400080;">UIBarStyleBlackOpaque</span>;</div>
<p>That wasn&#8217;t so hard. But the navigation bar for the modal view that pops up when the user taps &#8220;Edit&#8221; is still the default blue. So let&#8217;s change that as well:</p>
<p>First, if you haven&#8217;t already, make sure your AppDelegate implements the <em>UITabBarControllerDelegate</em>. Then add the optional delegate method <em>willBeginCustomizingViewControllers:</em> in your AppDelegate&#8217;s implementation file, and add the following lines of code:</p>
<div style="margin:0px 0px 20px;text-align:left;color:#000000; background-color:#F1EFE6; border: 1px solid rgb(211, 209, 199); padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">- (<span style="color:#881350;">void</span>)<span style="color:#6c0540;">tabBarController:</span>(<span style="color:#400080;">UITabBarController</span> *)controller <span style="color:#6c0540;">willBeginCustomizingViewControllers:</span>(<span style="color:#400080;">NSArray</span> *)viewControllers {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">UIView</span> *editView = [controller.view.subviews <span style="color:#6c0540;">objectAtIndex:</span><span style="color:#0000ff;">1</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">UINavigationBar</span> *modalNavBar = [editView.subviews <span style="color:#6c0540;">objectAtIndex:</span><span style="color:#0000ff;">0</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;modalNavBar.tintColor = [<span style="color:#400080;">UIColor</span> <span style="color:#6c0540;">orangeColor</span>];<br />
}</div>
<p>Again, it&#8217;s possible to set the <em>barStyle</em> property instead of the <em>tintColor</em>, but <em>barStyle</em> won&#8217;t give you all the colour options, of course.</p>
<p>Now that you have gained control of the modal view, you change more properties. By default, the navigation bar title says &#8220;Configure&#8221;, but you can change that as well, or how about the background colour? Here&#8217;s how:</p>
<div style="margin:0px 0px 20px;text-align:left;color:#000000; background-color:#F1EFE6; border: 1px solid rgb(211, 209, 199); padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; ">- (<span style="color:#881350;">void</span>)<span style="color:#6c0540;">tabBarController:</span>(<span style="color:#400080;">UITabBarController</span> *)controller <span style="color:#6c0540;">willBeginCustomizingViewControllers:</span>(<span style="color:#400080;">NSArray</span> *)viewControllers {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">UIView</span> *editView = [controller.view.subviews <span style="color:#6c0540;">objectAtIndex:</span><span style="color:#0000ff;">1</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;editView.backgroundColor = [<span style="color:#400080;">UIColor</span> <span style="color:#6c0540;">grayColor</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#400080;">UINavigationBar</span> *modalNavBar = [editView.subviews <span style="color:#6c0540;">objectAtIndex:</span><span style="color:#0000ff;">0</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;modalNavBar.tintColor = [<span style="color:#400080;">UIColor</span> <span style="color:#6c0540;">orangeColor</span>];<br />
&nbsp;&nbsp;&nbsp;&nbsp;modalNavBar.topItem.title = <span style="color:#760f15;">@&quot;Edit Tabs&quot;</span>;<br />
}</div>
<p>Regarding the HIG&#8230; I am not sure if all this is allowed. I will be submitting an update with an orange coloured navigation bar for both those views, and I believe other apps have it (NY Times) so I don&#8217;t think it goes against the HIG.</p>
<p>However, I don&#8217;t think it&#8217;s a good idea to change the <em>backgroundColor</em> property of the &#8220;editView&#8221;. I tried with a grey colour and it doesn&#8217;t look right. It might also get your app rejected, because it&#8217;s such a big change. That your navigation bars are the same colour throughout your app only makes it look better in my opinion, rather than having a blue navigation bar clash with the rest of your beautifully designed app :)</p>
]]></content:encoded>
			<wfw:commentRss>http://runmad.com/blog/2010/01/coloring-fun-with-morenavigationcontroller-and-it/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Translucent UINavigationBar</title>
		<link>http://runmad.com/blog/2009/09/translucent-uinavigationbar/</link>
		<comments>http://runmad.com/blog/2009/09/translucent-uinavigationbar/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 19:22:26 +0000</pubDate>
		<dc:creator>Rune Madsen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[tintColor]]></category>
		<category><![CDATA[uinavigationbar]]></category>

		<guid isPermaLink="false">http://www.davesenior.com/rune/?p=62</guid>
		<description><![CDATA[Apparently, making your UINavigationBar requires a (tiny) bit more code than just: After trying hard to change my UINavigationBar colour, and mostly giving up, I found out you have to set its tintColor to nil. self.navigationController.navigationBar.tintColor = nil; self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;]]></description>
			<content:encoded><![CDATA[<p>Apparently, making your UINavigationBar requires a (tiny) bit more code than just:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;">self.navigationController.navigationBar.barStyle <span class="sy0">=</span> UIBarStyleBlackTranslucent;</div>
</div>
<p>After trying hard to change my UINavigationBar colour, and mostly giving up, I found out you have to set its <em>tintColor</em> to <em>nil</em>.</p>
<div style="margin:0px 0px 20px;text-align:left;color:#000000; background-color:#F1EFE6; border: 1px solid rgb(211, 209, 199); padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; "><span style="color:#881350;">self</span>.navigationController.navigationBar.tintColor = <span style="color:#881350;">nil</span>;<br />
<span style="color:#881350;">self</span>.navigationController.navigationBar.barStyle = <span style="color:#400080;">UIBarStyleBlackTranslucent</span>;</div>
]]></content:encoded>
			<wfw:commentRss>http://runmad.com/blog/2009/09/translucent-uinavigationbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

