Piotr Byzia
Piotr Byzia

Reputation: 3423

UIImageView's initWithImage distortion

I'm creating a counter from PNG image using code similar to:

counterImage = [UIImage imageNamed:@"counter-1-2-inactive.png"];
UIImageView *counterImageView = [[[UIImageView alloc] initWithImage:counterImage] autorelease];
UILabel *countLabel = [[[UILabel alloc] initWithFrame:counterImageView.frame] autorelease];
[cell addSubview:counterImageView];
[counterImageView addSubview:countLabel];

You can see a result below, on the LHS there is a counter from iOS Simulator and on the RHS there is a original PNG.

Why the quality decreased slightly in the resulting UIImageView? How can I improve it? This is maybe only 1-pixel-height line, but in 1:1 scale is seems like a counter is shortened from the above.

Size of a resulting counterImageView is the same as original PNG: 40x24.

counter

Upvotes: 0

Views: 671

Answers (1)

Piotr Byzia
Piotr Byzia

Reputation: 3423

Sometimes one just needs to ask a question to find a solution in a "Related" section... ;-)

I applied a 1px transparent border based on comments on this question: Any quick and dirty anti-aliasing techniques for a rotated UIImageView?

Upvotes: 1

Related Questions