所以我得到了一個帶有4個獨立按鈕的ViewController。當點擊按鈕1時,TableViewController1用項目列表彈出ViewController。當選擇一個項目時,TableViewController1下拉,button1現在具有在表格中選擇的文本。這很好。但是當我使用TableViewController2對button2執行完全相同的操作時,button1中的數據將被重置。iOS/Xcode - 多個segue標識符重置數據解析
我用塞格斯使用標識符,一些代碼:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showEducation"]) {
NSIndexPath *indexPath = [self.tableViewEducation indexPathForSelectedRow];
ViewController *destViewController = segue.destinationViewController;
destViewController.educationText = [tableViewArray objectAtIndex:indexPath.row];
}
}
所以此刻我得到了每個按鈕和多重的.h和.m文件爲tableviews多個SEGUE標識符。我是否使用完全錯誤的技術來使其發揮作用?我希望我能夠清楚,否則我可以上傳圖片。
編輯:我只注意到,我的ViewController上也有一個滑塊。當單擊一個按鈕並在TableView中選擇一行時,滑塊將重置爲原始位置。與上述類似的問題。
是兩個獨立的TableViewController對象,它們的數據源使用相同的對象/類嗎? –
你是什麼意思? – Torylon
沒有一個類或對象有你的「'cellForRowAtIndexPath'」方法,還是每個TableViewController對象都有自己的? –