【发布时间】:2011-09-26 05:14:43
【问题描述】:
我想知道"stringByEvaluatingJavaScriptFromString"。
根据苹果文档。
"The result of running script or nil if it fails."
我有一个方法,在 for 循环中我将字符串值传递给 stringByEvaluatingJavaScriptFromString。它会做什么?这会得到每个字符串的响应还是会发生其他事情? 我就是这么干的……
- (void)loadWithStartPoint:(NSString *)startPoint endPoint:(NSMutableArray *)endPoints options:(UICGDirectionsOptions *)options {
for (int idx = 0; idx < [endPoints count]; idx ++)
{
NSString *msg = [NSString stringWithFormat:@"loadDirections('%@', '%@', %@)", startPoint, [endPoints objectAtIndex:idx], [options JSONRepresentation]];
[googleMapsAPI stringByEvaluatingJavaScriptFromString:msg];
}
}
为了得到对每个字符串的响应,我应该怎么做?我认为它应该响应我在这里传递的每个字符串。请告诉我我做错了什么以及我将如何操纵我的代码来响应我传递的所有字符串。 任何帮助将不胜感激。Thnx 提前。
【问题讨论】: