How to get [UIImage imageWithContentsOfFile:] and High Res Images working

前端 未结 6 1180
星月不相逢
星月不相逢 2020-12-24 08:57

As many people are complaining it seems that in the Apple SDK for the Retina Display there\'s a bug and imageWithContentsOfFile actually does not automatically load the 2x i

6条回答
  •  伪装坚强ぢ
    2020-12-24 09:35

    We just ran into this here at work. Here is my work-around that seems to hold water:

    NSString *imgFile = ...path to your file;
    NSData *imgData = [[NSData alloc] initWithContentsOfFile:imgFile];
    UIImage *img = [[UIImage alloc] initWithData:imgData];
    

提交回复
热议问题