<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1675857357303681434</id><updated>2024-10-09T18:06:24.845+08:00</updated><category term="iPhone"/><title type='text'>匠</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ppkko.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1675857357303681434/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://ppkko.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1675857357303681434.post-3124316168217174064</id><published>2011-05-20T00:20:00.002+08:00</published><updated>2011-05-20T00:23:13.932+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><title type='text'>TabBarController 加入 NavigationController</title><content type='html'>&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: c++&quot;&gt;/*
 *   ExampleAppDelegate.h
 */
@interface ExampleAppDelegate : NSObject &amp;lt;UIApplicationdelegate&amp;gt;
{
   UIWindow *window;
   UITabBarController *mainBar;
   UINavigationController *firstNav;
   UINavigationController *secondNav;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) UITabBarController *mainBar;
@property (nonatomic, retain) UINavigationController *firstNav;
@property (nonatomic, retain) UINavigationController *secondNav;

@end
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: c++&quot;&gt;/*
 *   ExampleAppDelegate.m
 */
#import &quot;ExampleAppDelegate.h&quot;
#import &quot;FirstView.h&quot;
#import &quot;SecondView.h&quot;

@implementation ExampleAppDelegate

@synthesize window;
@synthesize mainBar;
@synthesize firstNav;
@synthesize secondNav;

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   firstNav = [[UINavigationController alloc] init];
   FirstView *firstView = [[FirstView alloc] init];
   [firstNav pushViewController:firstView animated:YES];
   firstNav.tabBarItem.title = @&quot;First Tab&quot;;
   [firstView release];

   secondNav = [[UINavigationController alloc] init];
   SecondView *secondView = [[SecondView alloc] init];
   [secondNav pushViewController:secondView animated:YES];
   secondNav.tabBarItem.title = @&quot;Second Tab&quot;;
   [secondView release];

   mainBar = [[UITabBarController alloc] init];
   mainBar.viewControllers = [NSArray arrayWithObjects:
                                             firstView, secondView, nil];

   [self.window addSubview:mainBar.view];
   [self.window makeKeyAndVisible];
   return YES; 
}

- (void)dealloc
{
   [firstView release];
   [secondView release];
   [mainBar release];
   [window release];
   [super dealloc];
}

@end
&lt;/pre&gt;設定Navigation上的標題&lt;br /&gt;
&lt;pre class=&quot;brush: c++&quot;&gt;/*
 *   FirstView.m
 */
- (void)viewDidLoad
{
   self.navigationItem.title = @&quot;The First View&quot;;
}
&lt;/pre&gt;&lt;pre class=&quot;brush: c++&quot;&gt;/*
 *   SecondView.m
 */
- (void)viewDidLoad
{
   self.navigationItem.title = @&quot;The Second View&quot;;
}
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1675857357303681434/posts/default/3124316168217174064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1675857357303681434/posts/default/3124316168217174064'/><link rel='alternate' type='text/html' href='http://ppkko.blogspot.com/2011/05/tabbarcontroller-navigationcontroller.html' title='TabBarController 加入 NavigationController'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>