2 つのビューコントローラー間で文字列を渡したいのですが、常に (null) です
私のコード
GridViewController.h
#import <UIKit/UIKit.h>
@interface GridViewController : UIViewController {
}
@property (nonatomic, strong)UILabel * labelTitle;
@end
ViewController.m
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
(NSIndexPath *)indexPath{
NSString *currow =[self.mutableArray objectAtIndex:indexPath.row];
NSLog(@"the string is %@", currow);
//the string is Grappe, Brandy and Cognac
GridViewController * grid = [[GridViewController alloc]initWithNibName:@"GridViewController~iPhone" bundle:nil];
grid.labelTitle.text = currow;
NSLog(@"the string is %@", grid.labelTitle.text);
//the string is (null)
NSLog(@"the string is %@", currow);
//the string is Grappe, Brandy and Cognac
[self.navigationController pushViewController:grid animated:YES];
}