i have two image:
-map.png (1985 x 1162)(about 200kb)
-map@2x.png (3969 x 2324) (about 650kb)
now if load this image in this way:
imageMap = [UIImage imageNamed:@"map.png"];
viewMap = [[UIView alloc] initWithFrame:CGRectMake(0, 0, imageMap.size.width, imageMap.size.height)];
viewMap.center = CGPointMake(self.view.frame.size.height/2, self.view.frame.size.width/2);
viewMap.backgroundColor = [UIColor colorWithPatternImage:imageMap];
[self.view addSubview:viewMap];
the image does not load completely in iPhone4 (but works well in iPhone5) and I do not know why.
But if i put in bundle only
map@2x.png
and rename it in
map.png
using the same code, the image is loaded without problems.
what happens? thanks everybody
EDIT:
I think the problem comes from setting the background of a UIView
because if I modify the code like this:
imageMap = [UIImage imageNamed:@"map.png"];
viewMap = [[UIView alloc] initWithFrame:CGRectMake(0, 0, imageMap.size.width, imageMap.size.height)];
viewMap.center = CGPointMake(self.view.frame.size.height/2, self.view.frame.size.width/2);
// viewMap.backgroundColor = [UIColor colorWithPatternImage:imageMap];
[self.view addSubview:viewMap];
UIImageView *imageView = [[UIImageView alloc] initWithImage:imageMap];
[viewMap addSubview:imageView];
you can see the image correctly.