1.m で
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
NSString *carNumber = [self.carNumberArrayFromPlistFile objectAtIndex:row];
NSString *engineNumber = [self.engineNumberArrayFromPlistFile objectAtIndex:row];
CarInfo *oneCarInfo = [[CarInfo alloc] initWithCarNumber:carNumber engineNumber:engineNumber];
Two *two = [[Two alloc] initWithNibName:@"Two" bundle:nil];
two.car = oneCarInfo;
[self.navigationController pushViewController:two animated:YES];
[oneCarInfo release];
[two release];
}
two.h で
@interface Two : UITabBarController
{
CarInfo *car;
}
@property (nonatomic, retain)CarInfo *car;
また、なぜ Two.m の car は常に null なのですか? これで私を助けてください。君たちありがとう!
二メートル:
@interface Two ()
@end
@implementation Two
@synthesize car;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[super viewDidUnload];
self.car = nil;
}
- (void)dealloc
{
[super dealloc];
}
@end