我有視圖之間正確傳遞數據的問題,但沒有標準方式。iOS故事板傳遞數據navigationViewController
圖片說明我的問題:
我performSegueWithIdentifier兩個賽格瑞標識符中的一個,然後我想將數據傳遞到視圖控制器稱爲「FIRMY」或「Oddzialy」 。
傳遞數據的代碼:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"sLogowanieFirmy"]) {
FirmyVC *firmyVC = [segue destinationViewController];
firmyVC.tabFirmy = self.tabFirmy;
}
if ([[segue identifier] isEqualToString:@"sLogowanieOddzialy"]) {
OddzialyVC *oddzialyVC = [segue destinationViewController];
oddzialyVC.wybranaFirma = [self.tabFirmy objectAtIndex:0];
}
}
問題是與方法[賽格瑞destinationViewController] becouse destinationViewController爲SEGUE是NavigationViewController。
那麼什麼是正確的方式來傳遞數據,並有獨立的導航控制器?
也許你想看看了'NSNotificationCenter'類。 http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsnotificationcenter_Class/Reference/Reference.html – Dimme
沒有更方便的方法嗎? –