--我們已經建置了第一頁的畫面 但是點選所建造名稱並不會執行到第二頁面,所以現在所作的事是為了告知電腦,使用者按下按扭之後的事件
--加入類別(#import "ListViewController.h")在#import "RootViewController.h"之下
--更改下列程式的內容- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {............
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ListViewController *detailViewController = [[ListViewController alloc] initWithNibName:@"ListViewController" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
--如以上做法正確已經能看點選左邊箭頭,跑至道第二頁面
--如成功會發現點選進入後會沒有標題告知使用目前剛剛點哪個標題
--再來是編寫點選項目進到第二頁面的標題
--在- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 底下打
//進入選項的標題
NSString *title=nil;
if (indexPath.row==0)
{
title=@"ALL Contacts";
}
else if (indexPath.row==1)
{
title=@"Friends";
}
else if (indexPath.row==2)
{
title=@"Work";
}
detailViewController.title=title;
--如此一來點選項進入已經有標題了,但是這樣打太多行了所以簡略程式使用陣列
NSMutableArrray , 字典類別 NSmutableDictionary 來儲存聯絡人資料
NSArry----NSMutableArry
NSDictionary----NSMutableDictionary
NSSet----NSMutableSet
NSString----NSMutableString
左邊為不可更改類別,右邊的可以