亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

objective-c - iOS 模擬器中圖片顏色比原始圖片顏色深,如何獲取原始UIImage?
高洛峰
高洛峰 2017-04-25 09:04:33
0
1
731

環(huán)境:Xcode 7 + iOS9 模擬器
問題:使用IB方式構(gòu)建UI設(shè)置圖片的時候,發(fā)覺模擬器中UIImageView中的圖片顏色比原始圖片顏色深。而我希望得到的是原始圖片的效果。

新建了一個Demo,只放了一個ImageView。
圖片顏色有差異,模擬器中的圖片顏色(左圖)明顯比 IB中原始圖片(右圖)的顏色深。

做過以下嘗試,均未達(dá)到目的:

  1. 在xcassets文件中設(shè)置了圖片的渲染模式,設(shè)置圖片渲染模式為Original Image(如下圖),結(jié)果沒有效果。

  2. 我嘗試使用純代碼的方式設(shè)置UIImage結(jié)果還是沒有效果。

    UIImage *image = [UIImage imageNamed:@"personal"];
    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

3.然后使用方法 imageWithContentsOfFile: 獲取,結(jié)果還是一樣沒有效果。

    NSString *path = [[NSBundle mainBundle] pathForResource:@"personal.png" ofType:nil];
    UIImage *imageOfFile = [UIImage imageWithContentsOfFile:path];
    self.imageView.image = imageOfFile;
高洛峰
高洛峰

擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...

reply all(1)
僅有的幸福

The following are pictures of the results of my test:

Comparing the pictures, the above is @2X generated by RTImageAssets, and the below is @2X generated by myself.
There is no color difference when displayed in IB, but there is color difference when displayed in the simulator.

Picture file list

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template