好吧我正在学习数组以及如何像以前一样使用它们......(用于做很多脚本,但现在正在尝试学习开发ipad和iphone应用程序的Objective-C数组学习
但我的问题是,我有它它就会从雅虎财经与for循环一组数据..
但现在我的问题是,我怎么能与阵列的数据只是一个peice的已工作拉
这里是我的榜样
-(IBAction) clicked:(id)sender {
NSString * StockOneYahooFinance = [NSString stringWithFormat:@"http://finance.yahoo.com/q/hp?s=S+Historical+Prices"];
NSString * PulledStockOne = [NSString stringWithContentsOfURL:[NSURL URLWithString:StockOneYahooFinance] encoding:1 error:nil];
for (i=1;i<=10;i++){
NSString *StartPulling = [[PulledStockOne componentsSeparatedByString:@"nowrap align="] objectAtIndex:i];
NSString *StartOpen = [[StartPulling componentsSeparatedByString:@">"] objectAtIndex:3];
NSString *Open = [[StartOpen componentsSeparatedByString:@"<"] objectAtIndex:0];
NSString *StartClose = [[StartPulling componentsSeparatedByString:@">"] objectAtIndex:9];
NSString *Close = [[StartClose componentsSeparatedByString:@"<"] objectAtIndex:0];
NSMutableArray *StockOpens = [[NSMutableArray alloc] initWithCapacity:6];
[StockOpens addObject:Open];
sixtyday.text = [OpenValues objectAtIndex:10];
nintyday.text = [CloseValues objectAtIndex:10];
if ([OpenValues objectAtIndex:10]=[OpenValues objectAtIndex:11] {
sevenday.text = @"Plus One";
}
}
}
但现在我要像做
year.text=StockOpens[5];
我怎样才能做到这一点。
字典键有类似的东西吗?太好了! – 2012-07-28 17:32:23
是的!我通过链接到LLVM的文档更新了我的解决方案。 – jtomschroeder 2012-07-28 17:36:11
请注意,这也需要使用iOS 6或OS X 10.8 SDK附带的Foundation版本。 – 2012-07-28 18:07:06