0
您好,我在我的代碼創建了一個新組的子文件夾中加載圖像,並把所有的圖像,現在資源\ CountryFlags是我這樣做如何從資源
NSString *fileName = countryInfo.ImageUrl;
CCSprite *flag ;
NSString * fullPath = [[NSBundle mainBundle] pathForResource: [fileName stringByDeletingPathExtension]
ofType: [fileName pathExtension]
inDirectory: @"CountryFlags"];
if (fullPath)
{
UIImage *theImage = [UIImage imageWithContentsOfFile: fullPath];
if (theImage)
{
flag = [CCSprite spriteWithCGImage: [theImage CGImage] key: fileName];
flag.position = ccp(200, 265);
flag.scale = .255;
}
}
但FULLPATH總是得到零路徑並沒有得到代碼,所以任何人都不知道如何解決這個問題