因此,我查看了一堆 stackoverflow 答案,但似乎都没有帮助。也许这是一个特例?到目前为止,这是我的代码:
所以我将一个字符串分配给在另一个视图控制器中声明的属性。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
FinalRead *readings = [_fetchedResultsController objectAtIndexPath:indexPath];
FinalReadingViewController *detailViewController = [[FinalReadingViewController alloc] init];
detailViewController.lover = [NSString stringWithFormat:@"%@", readings.a1];
detailViewController.lover2 = [NSString stringWithFormat:@"%@", readings.a2];
detailViewController.monies = [NSString stringWithFormat:@"%@",readings.a3];
detailViewController.monies2 = [NSString stringWithFormat:@"%@", readings.a4];
detailViewController.healthy = [NSString stringWithFormat:@"%@", readings.a5];
detailViewController.healthy2 = [NSString stringWithFormat:@"%@",readings.a6];
[self.navigationController pushViewController:detailViewController animated:YES];
}
然后在下一个视图控制器中,我将字符串分配给另一个视图控制器中的另一个属性:
- (IBAction)loveClicked:(id)sender {
LoveDetailViewController *love = [[LoveDetailViewController alloc] init];
NSString *stringLove1 = self.healthy;
NSString *stringHealth2 = self.healthy2;
stringLove1 = love.loverly;
stringLove2 = love.loverly2;
[self.navigationController pushViewController: love animated:YES];
}
当我到达第三个视图控制器时,值出现为(null)。有任何想法吗?