<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Tewha.net</title>
    <link>https://tewha.net/tags/uilabel/</link>
    <description>Recent content on Tewha.net</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 01 Oct 2010 14:00:00 +0000</lastBuildDate>
    <atom:link href="https://tewha.net/tags/uilabel/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Changing UINavigationBar’s title text color</title>
      <link>https://tewha.net/2010/10/changing-uinavigationbars-title-text-color/</link>
      <pubDate>Fri, 01 Oct 2010 14:00:00 +0000</pubDate>
      <guid>https://tewha.net/2010/10/changing-uinavigationbars-title-text-color/</guid>
      <description>&lt;p&gt;How do you change UINavigationBar’s title color? You can’t, directly, but you can substitute your own view.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>How do you change UINavigationBar’s title color? You can’t, directly, but you can substitute your own view.</p>
<p>For example, start with <a href="http://developer.apple.com/library/ios/#samplecode/NavBar/Introduction/Intro.html">Apple’s NavBar sample</a>. Drop this code into <code>initWithNibName:bundle:</code> in <code>PageThreeViewController.m</code>:</p>
<pre><code>- (id)initWithNibName:(NSString *)nibNameOrNil
               bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
        // this will appear as the title in the navigation bar
        CGRect frame = CGRectMake(0, 0, 400, 44);
        UILabel *label = [[UILabel alloc] initWithFrame:frame];
        label.backgroundColor = [UIColor clearColor];
        label.font = [UIFont boldSystemFontOfSize:20.0];
        label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
        label.textAlignment = UITextAlignmentCenter;
        label.textColor = [UIColor yellowColor];
        self.navigationItem.titleView = label;
        label.text = NSLocalizedString(@&quot;PageThreeTitle&quot;, @&quot;&quot;);
        [label release];
    }

    return self;
}
</code></pre>]]></content:encoded>
    </item>
  </channel>
</rss>
