標籤:
第一種
[self.navigationController pushViewController:subTableViewController animated:YES];
//描述:通過 NSNavigationBar 進行跳轉 [self.navigationController popViewControllerAnimated:YES]; //描述:在子視圖返回到上級視圖
第二種
UIViewController *control = [[UIViewController alloc] init]; [self presentModalViewController:control animated:YES]; [control release]; //描述:通過事件進行跳轉 [self dismissModalViewControllerAnimated:YES]; //描述:通過事件進行返回。
第三種
[self.view.window addSubview:otherview]; [self.view removeFromSuperview]
資料傳遞:
1)採用代理模式 子viewcontroller設計 代理協議,定義協議介面,父viewcontroller 實現協議介面,實現子viewcontroller 退出時將相關資料更新到父視圖。
2)採用ios的訊息機制 父viewcontroller註冊訊息 子viewcontroller 發送訊息,觸發父viewcontroller的訊息處理。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setData:) name:kNotificationMessage object:nil];//註冊監聽,其中setData用來處理訊息
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationMessage object:self userInfo:infoDict];//發送訊息
3)採用database做為資料中間的儲存媒介,子viewcontroller將狀態資料存入DB,父viewcontroller從DB擷取資料更新view。
4)採用ios的NSDefault 儲存
5)通過AppDelegate 中定義全域變數實現中間資料的儲存。
【ios開發學習 - 第一課】頁面跳轉