我想在两个视图控制器之间传递一个字符串,但总是(空)
我的代码
GridViewController.h
#import <UIKit/UIKit.h>
@interface GridViewController : UIViewController {
}
@property (nonatomic, strong)UILabel * labelTitle;
@end
视图控制器.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];
}