Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Ernie11

macrumors member
Original poster
Apr 4, 2014
37
0
Hello everyone. Im working on the graphics of my app but I noticed that some of the backgrounds are a little blurry and on some the background is fine but the letters that I put straight into the background in photoshop are blurry. For what I know photoshop is the tool to do this for apps. This is the code im using to incorperate the background.
Code:
    UIGraphicsBeginImageContext(self.view.frame.size);
    [[UIImage imageNamed:@"Background.png"] drawInRect:self.view.bounds];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    self.view.backgroundColor = [UIColor colorWithPatternImage:image];

I also made some images to put as the background of cells but the different words I put there with photoshop aswell are blurry but the border of the "button" looks clear. Any tips, tricks, or tuts anyone can share would be great. Thanks.

[EDIT]
By the words I mean they are not as clear as the ones I added in using labels and such. Its the same font and color but not size, which shouldnt make a difference.

[EDIT 2]
Figured out the text being blurred part. Didnt add the @2x for them. I did check the other backgrounds and made sure the @2x was added and also checked to make sure they were really @2x. Still have the slight background blur.

E.
 
Last edited:

dantastic

macrumors 6502a
Jan 21, 2011
572
678
Code:
    UIGraphicsBeginImageContext(self.view.frame.size);
    [[UIImage imageNamed:@"Background.png"] drawInRect:self.view.bounds];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    self.view.backgroundColor = [UIColor colorWithPatternImage:image];

Why do you do that???? Like, really?

a couple of pointers,
1) make sure the device don't have to scale the image.
2) make sure the image is not drawn at any half pixel coordinates
3) don't incorporate text in images, use uilabels instead.

You can't just add a UIImageView?
 

Ernie11

macrumors member
Original poster
Apr 4, 2014
37
0
Ok I changed the previous code to:
Code:
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]]];
I was using the above one because for some reason when I would set the background it was 1 pixel off to the left. Its not anymore. Looks better which is what I was looking for. Thanks. Any other tips would be nice for future use of me or anyone else that runs into this post. Thanks again.

E.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.