2012-11-29 99 views
0

所以我真的很難與此。我的iPad應用程序有一個包含類別的側面菜單,一旦選擇加載一個UIViewController是一個容器。這個容器在左邊有一個自定義的UITableView,在右邊有一個自定義的UIView。UIContainerViewController控制器之間的通信

如何讓我的容器告訴UITableViewController選擇了哪個類別,以便它可以顯示正確的表格數據。那麼我的UITableViewController如何告訴詳細視圖顯示什麼?

這是一個UISplitView完全相同的功能,但我的界面是完全自定義設計的,看起來沒有像分割視圖,但功能就像它。

一直在努力的日子,任何幫助將不勝感激!非常感謝!

回答

1

我發現NSNotificationCenter特別有助於在不同ViewController之間發送信息。

爲了簡單解釋這個過程,您在ViewController中設置了一個Notification Listener,您希望得到通知,然後在ViewController中發送一個通知來進行發送。像這樣註冊監聽器:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeBatteryLabel) name:@"UIDeviceBatteryStateDidChangeNotification" object:nil]; 

而且這樣的張貼通知:

[[NSNotificationCenter defaultCenter] postNotificationName:@"logOutNotification" object:nil]; 
+0

這個偉大的工程什麼,我試圖做的!非常感謝! –