获取本地图片的方法

        NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"whiteShaow.png"];
        UIImage *shaowImage = [UIImage imageWithContentsOfFile:filePath];
获取到的是类似文件的相对路径(这么理解)具体这里面的@2x、@3x就是imageWithContentsOfFile:自动来匹配了
NSString *path = [[NSBundle mainBundle]pathForResource:@"whiteShaow" ofType:@"png"]
UIImage *iamge2 = [UIImage imageWithContentsOfFile:path];
是获取到的是具体的某一个文件@2x就是@2x,@3x就是@3x,而Login就是login,所以用login来获取图片的地址因为根本就不存在login这个图片```

猜你喜欢

转载自blog.csdn.net/weixin_33863087/article/details/87505447