2012-06-22 33 views

回答

1

可以使用NSBundle的方法来访问应用程序的资源:

NSString *imageFilePath = [[NSBundle mainBundle] pathForResource:@"imageName" ofType:@"png"]; 
UIImage *image = [UIImage imageWithContentsOfFile:imageFilePath]; 
+0

谢谢..它工作 – Pallavi

0

您可以从一个NSBundle类访问的资源。

如果您的资源位于当前应用程序可执行文件中,那么您需要使用“[NSBundle mainBundle]”。

如果您在应用程序中有主包,我们在NSBundle中有一个名为“allbundles”的属性。它将返回所有应用程序的非框架包的数组。因此,您可以从任何包中调用资源。

我觉得你这个月很有用。