The ios icon of a real machine is distorted.
Problem description: iPhone 5S, the icon pixel is 30*30, there is no problem in the simulator, when the real machine shows the icon edge will have a jagged distortion effect.
When the image pixel is reset to 60*60, the real machine displays no problem, but the icon is too large:
This method can be used to scale and adjust its size, but there will still be distortion.
CGSize size = CGSizeMake (30, 30); UIGraphicsBeginImageContext (size); [self. imageView. image drawInRect: CGRectMake (0, 0, size. width, size. height)]; self. imageView. image = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext ();
The previous demo can be scaled without loss.
// Zoom out the image self. imageView. transform = CGAffineTransformScale (self. imageView. transform, 0.5, 0.5 );
Now the problem is solved.
The first is the resolution problem. It is not a high-definition resolution at the beginning, so it must be distorted. The following is an official reference.
Icon and image size
The second problem is lossless scaling.
However, tabBar is somewhat different.
First, the resolution meets the requirements and is loaded.
It not only blocks the text but also displays too large.
In storyboard, there is only one restriction attribute.
It indicates the relative constraint based on the tabBaritem, so use it according to the constraint.