Reputation: 601
I have a myriad of UIImageViews
that act as 'tiles' on a map. They align up next to one another to form a grid of images.
Ordinarily, the grid images are flush against each other, but whenever the iPhone or iPad device is rotated, or if a UIView
is applied to the view that contains these tiles, the spaces between the UIImageViews
become momentarily visible, showing off the grid pattern that I'd like to be invisible.
Any ideas what might be causing this?
Thanks
Upvotes: 1
Views: 214
Reputation: 125007
Consider using CATiledLayer to draw all the images in a single view instead of using multiple subviews. There's a nice writeup on using it at Cocoa Is My Girlfriend. CATiledLayer makes it easy to build an image out of smaller tiles, display higher resolution images as the user zooms in, and avoid memory problems that come from keeping too much of a large image loaded.
Upvotes: 3
Reputation: 73628
this is happening because you are using different views (here uiimageview
). Since they are not part of the same fabric during any animation or change in view hierarchy there is a chance that the gap between them would be visible.
This is a very common problem in graphics programming. The way to fix this problem is to have one single view and add these uiimageviews
as sub-layers to this view. That way all the imageviews are part of the same fabric and the gap would not be visible.
I did not post any code but then so did you ;)
Upvotes: 3