How to fix blurred text on an iPhone 6 (+) - ios

We use a custom font face and custom font sizes in our application.
When running the application on an iPhone 6 (haven't tried 6+ yet but I assume it's the same) all fonts look blurry. We also have an internal tool that uses the system font and it looks blurry as well.
Why is that and what is the right approach to get them to render as crisp as they do on an iPhone 5?

Perhaps your labels or drawing points aren't on an exact pixel, but instead on a fractional pixel. To prevent such situations use methods like ceilf(), floorf() and CGRectIntegral().

Related

UI size changes when switching to a different device

So I am quite new to Unity Development, and I have run into a problem. I have two UI's in my game (two buttons), however, when I change the device from an Iphone 12 (landscape) to a Iphone 11 (landscape), the UI's ratio goes all whacky and it changes size. Is there any way I can prevent this? I will link photos below
So this is what it looks like if the camera is in the Iphone 12 landscape 'mode'
and this is what it looks like in Iphone 11 'mode'
The ratio and size of the UI goes all whacky. How do I fix this?
(a picture of my canvas inspector
One thing that comes to mind is to change the Canvas Scalers UI Scale Mode from "Constant Pixel Size" to one of the other options, depending on what works best for you.
Unfortunately, "Constant Pixel Size" is the default value and it usually breaks everything when building a full screen UI.
For canvas settings, use the "scale with screen size" option and play around with the values. If most of the resolutions look fine but there is a spesific one that straight up breaks your UI, you can write a script to check if its that resolution and change the canvas values.
For UI elements you can play around with the setting I circled in red.
Also you might want to check this thread.

Adapting iOS UI to work for tvOS

We have an iOS app and we were asked to also support tvOS. All our UI is done in .xib files, but the problem is that all the sizes for views, margins, text, etc. are in points. That was totally fine for the iPhones and iPads, as the points are pixels multiplied by a scale to get them to look the same on all resolutions.
But when we built the app for tvOS, all our views are small and in the center of the pages. I read that this is caused because the resolution for tvOS is 1080p, with a scale of 1x. See article here.
For the UI to look the same, I would like to multiply everything by a scale of 4. By everything, I mean again: view size, text size, margins, spacing, etc.
Is there a way of doing such a thing without completely rewiring the UI?

What is a good approach for scaling/drawing images for different screen sizes?

In my iPhone app, I have a control that takes on quite different sizes on different screens. For example, (in the iOS point coordinates)
3.5 inch devices (iPhone 4S): 242x295
4 inch devices (iPhone 5 series, SE): 242x383
4.7 inch devices (iPhone 6 series): 297x482
5.5 inch devices (iPhone 6 Plus series): 336x551
As you can see, these control sizes are not proportional.
The problem
This control has an image as its background. That particular image is important for brand identity and the custom appearance that my company's designer wants to go with. The image gives the appearance of a material and has a texture. It also has shadows within itself. I would like to apply this image on to controls of different screen sizes (my control sizes are determined at runtime according to available space, as Apple may come up with new screen sizes anytime).
My current solution
The designer makes separate PNGs for me for each screen size and I hard code it with onto my control using an if-else for screen size (after determining the size mathematically before hand). As you can probably tell, this is a horrible approach for robustness. I'm also looking to expand to iPad and having a better scaling system will certainly help.
An idea
I take an image that's the smallest unit of the repeating texture and apply it to my control with the scaling option that repeats it throughout to obtain a final image.
HOWEVER, I lose my shadows and rounded edges this way. (I tried simply using the largest image as well and the disproportionate scaling makes the rounded edges horrible)
I tried looking for solutions and most resources do not deal with such images. I simply cannot lose any part of this image and it should be fully applied to the control, shadows and corners included.
I apologize if any or all of this is naive or if I didn't look for answers using the correct words. This is my first time posting here at Stack Overflow, and I'm looking forward to hearing from you guys.
Thanks!
p
Edit:
This is applied to a custom UIButton based control to give the appearance of a card.
Edit 2: Wain seems to have suggested a perfect answer. I will try it and let everyone know the results.
I'd use tiling as you describe, and I'd combine that with changing the view layer corner radius and applying a shadow offset. In this way you can separate the important part of the image and make it nicely reusable and you can leverage the capability of CALayer.
Note that when you set the shadowOffset of the layer you should also look at the shadowColor, shadowRadius and shadowOpacity.
You can used Assets.xcassets for managing images in ios. you can make image in 1x,2x and 3x scale.
For example you want an icon of size 50x50 pixel then 1x should be 50x50,
2x should be 100x100 and 3x should be 150x150. then ios automatically take appropriate image from this set.
Hope this will help :)
The aspect ration of iPhone 5, iPhone 6 and iPhone 6P are almost same. however the aspect ration of iPhone 4 is different.
Here is the steps which helps you.
So you need one image which image is suitable for iPhone 5 and its
#2x, and #3x image and iPhone 4 and its #2x image,
i.e if you have image with 242x383 for iPhone 5 then you need images
with its #2x, and #3x images. and you need image which is compatible
with iPhone 4 size.
You need to set UIImageView's contentMode as aspectFit.
So the idea is, make iPhone 5's image and its #2x, #3x images and iPhone 4's image differently. or you can put all things in UIScrollView and for iPhone 4 set contentSize of scrollView is 568. and make different image for iPad.

Text Scaling on iPhone 6/6 plus

It seems like fonts other than the system font will be scaled up rather large on the iPhone 6 (particularly plus). Is the way to deal with this just to use smaller sized fonts when on a large screen? In my case I'm primarily using Arial-BoldMT. Similarly, the default keyboard is scaled up as well. Is this due to the same issue? Thanks!

Two UILabels rendered differently in retina and non retina iPhone displays

I have designed an interface in a NIB which has two UILabels. The labels are in close proximity to highlight one particular word in a different colour.
The issue is that on a non retina display the two labels render as desired. See Image 1:
However on a retina display the label for the white text overlaps some of the blue text. See Image 2:
Note that the frame of the white text label doesn't seem to have moved rather the issue seems to be the word wrap on the blue text label.
Has anyone seen this before and figured out a quick/ painless cure?
Posting as an answer as requested:
This looks like a possible bug or edge case with the larger label's size. If you widen it by a single point, it may wrap correctly on both devices. It may be worth reporting this as a bug, since the objects should behave identically on retina and non-retina devices.
This will be a non-issue for you in iOS 6, anyway :)

Resources