【发布时间】:2011-12-17 16:24:36
【问题描述】:
我有一个读取 json 数据的视图。并从中提取密钥。
在 - (void)viewDidLoad { 我执行以下操作:
hotellat = [rows4 valueForKey:@"H_LAT"];
hotellon = [rows4 valueForKey:@"H_LON"];
然后我在 viewDidLoad 之后执行推送,如下所示:
- (IBAction)buttonClicked:(id)sender
{
NSLog(@"hotellat: %@",hotellat);
MapTutorialViewController *controller = [[MapTutorialViewController alloc] initWithNibName:@"MapTutorialViewController" bundle:[NSBundle mainBundle]];
controller.LAT = hotellat;
controller.LON = hotellon;
[self.navigationController pushViewController:controller animated:YES];
[controller release];
}
本节的NSlog显示hotellat为null,但是当我在viewDidload中写入nslog时,有一个值。我需要做什么才能让这个变量传递给下一个视图?这也是一个字符串,我想我需要将它转换为整数,以便我可以将它分配给地图视图中的纬度?
我也@synthesize hotellat,hotellon;在控制器中并在 .h 文件中有以下内容:
@property (nonatomic, retain) NSString *hotellat;
@property (nonatomic, retain) NSString *hotellon;
【问题讨论】: