在第二個tableview中添加和刪除行我有2 UITableViews
在一個ViewController
說table1和table2。點擊一個表格中的項目1我將該項目添加到表格2。表1中的其中一項說objectAtIndex
1顯示另一個Viewcontrller
。第二個viewcontroller
有一個後退按鈕和保存按鈕。只有在第二個視圖控制器中的保存按鈕被點擊的情況下,我纔想將這個項目添加到表2中。一個想法?根據條件
- (void)viewWillAppear:(BOOL)animated
{
if (self.moveItem && self.indexRow != -1) {
// Your logic to move data from one array to another based on self.indexRow
// May like below
// item = [firtsArray objectAtIndex:self.indexRow];
// [secondArray arrayByAddingObject:item];
// [firtsArray removeObjectAtIndex:self.indexRow];
// Reload your both table view
[selectedCallType addObject:[callType objectAtIndex:self.indexRow]];
[selectedCallTypeId addObject:[callTypeId objectAtIndex:self.indexRow]];
self.moveItem = NO;
}
NSLog(@"Call Type Array = %@",selectedCallType);
NSLog(@"Call Type Id Array = %@",selectedCallTypeId);
[table reloadData];
[table2 reloadData];
}
謝謝。
它只是在一個視圖 - 控制兩個表。我有2個viewcotrollers – LeXeR
你需要更清楚 – rishi
基本上,當點擊表1中的單元格我正在顯示另一個有兩個按鈕(保存和返回)的viewcontroller。只有在第二個視圖控制器中單擊保存時,我單擊的單元格才應添加到表格2中。 – LeXeR