3

I am having a label in a view.After scaling the view, the label looks little blurred,the resolution is lost.How to retain the resolution after scaling.

Here is my code for scaling

secondView.transform = CGAffineTransformIdentity;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
secondView.transform = CGAffineTransformMakeScale(2 ,2);
[UIView commitAnimations];
[self.view bringSubviewToFront:secondView];
halfer
  • 19,824
  • 17
  • 99
  • 186
Warrior
  • 39,156
  • 44
  • 139
  • 214
  • What's your secondView.contentMode property value? – zrzka Mar 23 '11 at 09:45
  • I didnt set that property at all.. – Warrior Mar 23 '11 at 10:08
  • I did guess you didn't, but I did ask what is this property value, never mind. Try to set it to *Redraw to force redrawing or redraw the view by yourself. Views are cached (kind of bitmaps) and these bitmaps are scaled up/down upon changes of some properties, etc. – zrzka Mar 23 '11 at 14:31

2 Answers2

3

I set the ContentScaleFactor property of the label to retain the resolution of the label after scaling .

[label setContentScaleFactor:2];
Warrior
  • 39,156
  • 44
  • 139
  • 214
  • This does not seem to work in my sample project. Can you provide an example application? My code: http://pastebin.com/9PFUTM4Y – M0rph3v5 Mar 28 '12 at 13:14
-2

Create a label of big size itself, scale down using transformations when you add it to the view. So at the run time when the view will scaleup the label's resolution will not be lost.

This is one of the approach.

Thanks

D25
  • 283
  • 1
  • 4
  • 17