Why does my text look so bad in my ios App? - iphone

I have a uiscrollview that has a custom child view that contains text and images.
The text items are UILabels. I have attached an image representing the quality issue:
Do you guys think it might be worth a shot to draw the text, then convert to a uiimage and display that instead? Maybe it would scale better? Or perhaps there is a way to smooth the text?

There's no reason to expect that you're going to draw the text better than UILabel does. Your picture is very hard to make out, but here's what you want to look at:
Are you just adding a UILabel to the UIScrollView's contentView, or are you doing something else fancier. That "something else fancier" could easily be the problem.
Make sure you're drawing on pixel-aligned boundaries. The easiest way is to make sure the origin of your UILabel is integral (not a fraction). On a retina display, you can get away with half-points, but it's usually easier just to make everything integers.

I thinks it is the position issue. I bet you set the x or y value to float value like 12.3 or 12.5 .

What I have done now is I have created a uiimage version of my text and am showing that now instead of the uilabels, the quality is soo much better, you can really see the difference when you are looking at it scaled up on the ipad, it must just do a better job scaling images then text?
Before:
After:
The above images show how the text renders on the ipad with my app scaled up, before and after my change.

Related

UITableViewCell Background stretching

I have a problem in Swift with UITableViewCell background image. Let's say that it shows quite fine one iPhone5 but on iPhone 6Plus it is stretch and thus it looks bad. This is probably due to Aspect fill or something which I really couldn't manage to change and achieve what I want so would be the best if someone could poke sample code I am providing as well as image how it should look, so anyone can check it out and maybe give me some hint or tip or sample code or even fixed demo version.
So here it is:
Note that on left side there is a curve (like half a circle) around right side of icon. On bigger phones or tablet, that curve gets super stretch thus completely destroying the look.
Demo code link
Thanks all in advance for any help. I am pretty stuck with this one.
You can stretch an image while preserving the aspect ratio of a portion of that image using slicing. Xcode offers a graphical interface for doing this. The idea is that you decide what parts of the image are allowed to stretch and which aren't.
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/chapters/SlicinganImage.html

Stretch UILabel background dynamically.

I'm trying to recreate this UITableView cell design.
This is as far as I have got...
I'm looking for a way of stretching the background of my UILabel dynamically. It needs to stretch at a specific point in the middle of my background.png image.
Does something like this exist? Am I going about solving this problem the right way?
I'm very new to iPhone dev so please be gentle.
Well there are many solutions, first you can set the image as a background color.
This is what you have done already by the looks of it, but you need to make the image repeatable.
Meaning it can't really have a start or an end.
Another way is to add an UIImageView behind the UILabel and set the image to a stretchable with a left and top cap.
This wil stretch the image but will leave the top/bottom and beginning/end the way they are.
You can read more about this in the Apple doc: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html

Custom UIButton hard to press

If I add a basic UIButton all is well, they are always easy to press every time. However, when I make a custom version using my own .png it becomes hard to trigger every time.
My custom button is a little smaller 32x32 and is mostly transparent. Could it simply be that its smaller, could the transparency be a problem..?
many thanks for any thoughts..
Maybe it is because it's smaller than 32x32, try making your transparency layer a little bigger, say 40x40 to have a bigger hit area. I mean use a bigger PNG :)
Check whether you have overhided any touches method and not called super in it...
Keep the frame of the view to 40*40 and clear the background color then set the image which is 32*32... It will work correctly

Image "frame/window" on iphone

I have numerous photos in portrait and landscape format. I want to be able to display a "crop" of the photo in a UIImageView on the iphone. If the picture is in landscape format I want it to resize to fit the frame, if it is in portrait format I need it to resize to fit the width, and then be cropped at the top and bottom. As if there is a "window" over the image - so it looks like a landscape picture.
It would be even better if this could be a UIButton - although I am aware that I can use touchesBegan and such on images to make it behave like a button if needs be.
Thanks for any help you can give me.
Thanks
Tom
In an ImageView, you can change the View Mode to Aspect Fill. It will give you the right scaling/cropping you want.
For interactions, you can use a Custom button with no drawing at all (no Title, no Image, no Background) with the same size as your ImageView. That would be safe with regards to the image aspect. I've tried similar stuff using the button's Background or Image properties, it can have some undesired effects (I've ran into a resizing issue on iOS 3.1.3 for instance).
1°) To Crop the Image, try to add a method to UIImage class to do it (you can google it without problem, or even on StackOverFlow)
2°) To add a "window" over your image, just add an UIImageView over your image wich has transparency. It should work ;-)
3°) To know when an image is touched, you can use "touchesBegan" to detect which image were selected. But I think it's the last of your problems ^^
What you cant to achieve isn't so hard, just to it step by step !
If you want more help in one step, say it. But I can't code it all for you ;-)
Good Luck

Changing color of part of an image

I have a png image file that is partly opaque and partly transparent. I display it in a UIImageView as a mask of sorts over another UIImageView layered behind it (as a sibling subview of a common superview). It gives me perfect borders around something painted using a finger on the lower UIImageView in my stack of UIImageViews. Perhaps there are better ways to do this, but I am new-ish, and this is the best way I came up with thus far. None the less, my app is in the App Store and now I want to enhance it to provide more images to use as the mask of sorts over the finger painting. But I don't want to bloat my bundle size by adding more static mask images as I did for the initial implementation. Not to mention I don't want to spend lots of time in photoshop making 100 masks. I'd rather programmatically change the color of the mask, without affecting the clear portion in the middle, which is not a simple regtangle or circle, but rather a complex shape. So my question is this: How can I change the colored portion of my loaded image without affecting the clear color portion in the middle? Is there a reasonably easy way to do this? Essentially I want to do what is described in this post (How would I tint an image programmatically on the iPhone?) without affecting the clear portion of my image. Thanks for any insights.
Have a look at the Tinted Image sample project. Try out the different modes until you get the effect you want.