-1
尝试使用像(/Users/sai/Desktop/images/aaa.jpg)这样的路径从MAC桌面上存在的文件夹中加载图像,该图像在名为Data的plist文件中创建项目0处的.plist。 作为使用一个NSBundle它diaplying图像路径而不是从。我已经做了很多的研究还是没能找到解决.Plz帮我。这里是代码使用NSBundle和plist从文件夹中加载图像
NSString *path=[[NSBundle mainBundle]pathForResource:@"Data" ofType:@"plist"];
NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:path];
NSString *errorDesc = nil;
NSPropertyListFormat format;
NSDictionary *temp = (NSDictionary *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc];
NSArray *array=[NSArray arrayWithArray:[temp objectForKey:@"images"]];
NSString *object=[array objectAtIndex:0];
NSLog(@"object at index i %@",[object lastPathComponent]);
NSString *image=[object lastPathComponent];
mImageView.image=[UIImage imageNamed:image];
[self.view addSubview:mImageView];
桌面加载图像IM这里是Data.plist
的屏幕截图
现在即时通讯工作在模拟器即时通讯试图从系统中获取图像。我有一个疑问,是否有可能与您的答案是清除它不是。 – lreddy
你可以从任何包或文档目录:) – iPatel
实际上我试图从其他文件夹中选择使用该图像路径的iphone设备中的特定图像。你会为此提出答案吗? – lreddy