- Inserting data from one table to another table
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- ActionList * actionListObj = [appDelegate.actionArray objectAtIndex:indexPath.row];
- self.chooseActions = actionListObj.actionName;
- MainTableController * mainViewController = [[MainTableController alloc] init];
- [mainViewController getAction:self.chooseActions];
- [self.navigationController dismissModalViewControllerAnimated:YES];
- }
- -(void) viewWillAppear:(BOOL)animated{
- [self reloadData];
- }
- -(void) reloadData{
- [self.myTableView reloadData];
- }
- -(void) getAction: (NSString *) actionChoose{
- self.action = actionChoose;
- [self reloadData];
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *CellIdentifier = @"Cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
- }
- // Configure the cell...
- cell.textLabel.text = self.action;
- return cell;
- }
- MainTableController * mainViewController = [[MainTableController alloc] init];
- @property(readwrite, assign) MainViewController *mainViewController;
- // and ...
- @synthesize mainViewController;
- // in main view controller
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- // alloc/init the sub VC
- subVCInstance.mainViewController = self;
- [self pushViewController:subVCInstance ......
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- ActionList * actionListObj = [appDelegate.actionArray objectAtIndex:indexPath.row];
- self.chooseActions = actionListObj.actionName;
- //MainTableController * mainViewController = [[MainTableController alloc] init];
- [self.mainViewController getAction:self.chooseActions];
- [self.navigationController dismissModalViewControllerAnimated:YES];
- }
- MainTableController * mainViewController = [[MainTableController alloc] init];
- [mainViewController getAction:self.chooseActions];