2012-11-05 146 views
0

今天我有严重的大脑问题。我将数据从UITableView传递到ViewController。基本上我想要实现的是动态填充[email protected]"dynamicallypopulated"与来自UITableView(它将继续获得关联的txt文件)。当我单步执行代码时,即使它设置在其上方,我可以输出它,但值为NULL动态填充pathForResource

代码:提前

NSString *location = self.animalTitle; 

    NSLog(@"path : %@",animalTitle); 
    NSLog(@"path : %@",location); 

    //initWithFormat:@"Your favorite color is %@", favoriteColorTextField.text 

    NSString *path = [[NSBundle mainBundle] pathForResource:[location to be dynamic!!! what should I put here?] ofType:@"txt"]; 

谢谢!

Jeremy

回答

0

Ug。

我解决了它。代码没有问题。它必须处理我提交的文件,其中提供的内容被缓存,项目需要一个很好的清理......讽刺的是,这是我首先要做的。尽管如此,下面是代码完成和工作。

NSString *path = [[NSBundle mainBundle] pathForResource:animalTitle ofType:@"txt"]; 

Brian放屁解决了。

谢谢!