这很简单,但我真的不知道为什么它总是给我null。
- 第一视图控制器:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[_tableView deselectRowAtIndexPath:indexPath animated:YES];
SubViewViewController *viewTwo = [[SubViewViewController alloc] initWithNibName:@"SubViewViewController" bundle:[NSBundle mainBundle]];
viewTwo.queryValue = [NSString stringWithFormat:@"%d",indexPath.row];
[self.navigationController pushViewController:self.subViewController animated:YES];
}
- SecondViewcontroller.h:
NSString *queryValue;
@property (nonatomic, retain) NSString *queryValue;
- SecondViewcontroller.m:
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"%@", self.queryValue);
}