附件是我创建的单视图 iPhone 应用程序的快照。我有一个从事件单元到第二个屏幕,即受邀者列表的转场。我有另一个从 Invitees 到 Checkin 的 segue。因此,当我从“事件”转到“受邀者”时,导航按钮会显示“事件”,这正是我想要的。但是,当我单击 Lisa Webb 单元格时,在签入时,导航按钮会显示 Lisa Webb。当我单击 Lisa Webb 导航按钮时,我会看到相同的签入页面,但现在导航按钮显示事件 A,这是我在事件列表上单击的。我想在签到页面上显示受邀者而不是 Lisa Webb,然后返回受邀者。我不知道该怎么做。我正在使用导航控制器。
下面是我从受邀者(第 2 次)到检查(第 3 次)的 prepareForSegue 的代码
#pragma mark - Segue
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"InviteesToCheckIn"]) {
//UIViewController *inviteesViewController = [segue destinationViewController];
CheckInViewController *checkInViewController = [segue destinationViewController];
// In order to manipulate the destination view controller, another check on which table (search or normal) is displayed is needed
if(sender == self.searchDisplayController.searchResultsTableView) {
NSIndexPath *indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
NSString *destinationTitle = [[filteredInviteesArray objectAtIndex:[indexPath row]] InviteeName];
NSNumber *selectedInviteeId = [[filteredInviteesArray objectAtIndex:[indexPath row]] InviteeId];
[checkInViewController setTitle:destinationTitle];
checkInViewController.inviteeId = selectedInviteeId;
}
else {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSString *destinationTitle = [[theInvitees objectAtIndex:[indexPath row]] InviteeName];
NSNumber *selectedInviteeId = [[theInvitees objectAtIndex:[indexPath row]] InviteeId];
[checkInViewController setTitle:destinationTitle];
checkInViewController.inviteeId = selectedInviteeId;
}
}
}
pragma mark - 表视图委托
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
*/
[self performSegueWithIdentifier:@"InviteesToCheckIn" sender:tableView];
}