I am developing an iPad application with a custom split view. In the main view, I have a tableViewController. I add items to this button with the add button on the navigation bar. This button is connected (I work with the storyboard) using a popover segue for another tableViewController that contains several cells for data input. The save button rejects the popover view above the add item in the masterView list. What I want to do next is the prototype link cells of the link wizard for another view to allow the user to edit the selected item. I want to associate this view with a popover segue (as with the add button), and there is a problem there: I get a red error from xcode: Failed to compile the connection: => anchorView = →.
This is a sample of my code that works great. I would like to do the same when I click on a cell for editing.
MasterSplitView table
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"assetCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
AssetModel *myAssetModel = [self.arrayAsset objectAtIndex:indexPath.row];
cell.textLabel.text = myAssetModel.name;
return cell;
}
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"addAssetSegue"]){
AddAssetTVC *addAssetTVC = segue.destinationViewController;
addAssetTVC.delegate = self;
UIStoryboardPopoverSegue* popoverSegue = (UIStoryboardPopoverSegue*)segue;
[addAssetTVC setPopoverController:[popoverSegue popoverController]];
}
}
- (void) theSaveButtonOnTheAddAssetTVCWasTapped:(AddAssetTVC *)controller{
[controller.navigationController popViewControllerAnimated:YES];
[self reloadCache];
[self.tableView reloadData];
[self viewDidLoad];
}
And the method of saving the type of add:
- (IBAction)save:(id)sender{
[popoverController dismissPopoverAnimated:YES];
NSLog(@"Telling the ADDASSET Delegate that Save was tapped on the AddAssetTVC");
{...unrevelant coredata methods}
[self.delegate theSaveButtonOnTheAddAssetTVCWasTapped:self];
}
Thanks for reading,
Alexander
source
share