问题
I have a very strange problem in my app which only happen on Retina display and not simulator.
I developped a set of applications with embedded openstreetmaps tiles (pieces of map).
In each app, I have a lot of pieces of map (256px/256px) that I display in a UIScrollView. It works perfectly on non-retina devices and on retina simulator.
The problem : each tile appear with the last row of pixel in a randow color (most time it's black)
To illustrate, I made to screenshot of the same place, with device and simulator. They are grouped in one picture :
You can see that the black pixel line is not out of the tile, but in the tile last pixel line (cause no shift beetwen the two screens)
More strange even : sometimes, when little color variation are in the tile, the pixel line take the color of a random element, and sometimes it doesn't appear at all !
Here, blue line, gray lines, black lines.....
EDIT :
I simplified a lot the code, and the glitch stays with only this 2-tiles loading :
int W = 256;
int H = 256;
NSString * map1 = [[NSBundle mainBundle] pathForResource:@"test1.png" ofType:nil];
NSString * map2 = [[NSBundle mainBundle] pathForResource:@"test2.png" ofType:nil];
UIImageView * pieceOfMap1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, H*0, W, H)];
UIImageView * pieceOfMap2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, H*1, W, H)];
[pieceOfMap1 setImage:[UIImage imageWithContentsOfFile:map1]];
[pieceOfMap2 setImage:[UIImage imageWithContentsOfFile:map2]];
[self.view addSubview:pieceOfMap1];
[self.view addSubview:pieceOfMap2];
I tryed with 128x128 @2x tiles, but the problem persists !
Could it come from OpenStreetMaps images ?
My two tiles are downloadable here : http://dl.free.fr/n08C6JIqW
回答1:
Okay.
I just open the two test tiles in photoshop, made no change, then saved again in png.
The black line doesn't appear anymore.
So it comes from the open street map PNG images (to get one of them, go to http://www.openstreetmap.org/, right clic on the map, then save image)
The problem is partly explained, but now I have 2067 files to photoshop...
I googled it, but I found nothing which would explain something...
If no other explanation, i will accept my own answer, but if someone give me something to understand why, I would be glad.
来源:https://stackoverflow.com/questions/11519152/strange-arctefact-in-uiimage-juxtaposition-on-retina-display