NavigationBar 可用以下方法替換 Back 返回鍵( 位於導覽列的左邊 ) :
//*.m
-(void)viewDidLoad{
MyViewController *myViewController = [[MyViewController alloc] init];
//製作 MyViewController 導覽列的左按鈕 :: 並設定按鈕動作為回主畫面
UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc]
initWithImage:[UIImage imageNamed:@"item-back.png"]
style:UIBarButtonItemStyleBordered
target:self
action:@selector(goRootHome)];
//設定目標 View 的 NavigationBar 左按鈕
myViewController.navigationItem.leftBarButtonItem = leftBarButton;
[leftBarButton release];
[super viewDidLoad];
}
-(void)goRootHome{
//回到當前導覽順序的最根本 View
[self.navigationController popToRootViewControllerAnimated:YES];
}