1、项目设置中Build Phases > Copy Bundle Resources 中可以查看已经添加进去的资源文件,如果里面没有,那就需要在这里手动添加了
2、路径命名的问题
NSString *imagePath=[[NSBundle mainBundle]pathForResource:@"school3" ofType:@"png"];
UIImage *image=[UIImage imageWithContentsOfFile:imagePath];
NSLog(@"%@",image);
self.imageView.image=image;
所以图片无法显示,应改成:
NSString *imagePath=[[NSBundle mainBundle]pathForResource:@"school_3" ofType:@"png"];