加载指定bundleName照片

来源:互联网 发布:雅可比矩阵公式 编辑:程序博客网 时间:2024/04/28 07:48

- (UIImage *)imageNamed:(NSString *)name ofBundle:(NSString *)bundleName {

    UIImage *image =nil;

    NSString *image_name = [NSStringstringWithFormat:@"%@.png", name];

    NSString *resourcePath = [[NSBundlemainBundle] resourcePath];

    NSString *bundlePath = [resourcePathstringByAppendingPathComponent:bundleName];

    NSString *image_path = [bundlePathstringByAppendingPathComponent:image_name];

    image = [[UIImagealloc] initWithContentsOfFile:image_path];

    

    return image;

}

0 0
原创粉丝点击