Questions tagged uilabel

Explore the latest questions and answers asked by our top developers.

In iOS 15, Soft hyphen is not working properly when using unicode character in UILabel

In iOS 15 soft hyphens (u{00AD}) are not considered when setting text on UILabel. for example: The following code does render the text with the soft hyphen correctly in iOS 13 & 14, but not in iOS 15. import UIKit class ViewController: UIViewController { @IBOutlet weak var label: UILabel! override func viewDidLoad() { super.viewDidLoad() label.text […]

By Renato Stauffer
Categorised as ios, ios15, soft-hyphen, swift, uilabel Tagged , , , ,

UILabel overlap in UICollectionView Xamarin.ios

I needed to create a UICollectionView containing the profiles of users searched in my database. The UICollectionView must contain a UILabel and a UIImage, the name and image must be taken from PHP. I currently get both, but when I go to do a new search, the old information overlaps the new, creating a confusing […]

By Alessandro Ledda
Categorised as Uncategorised Tagged , ,

How to apply bold and italics for the applied custom font in the UILabel?

For the UILabel I have applied a custom font and i tried to apply bold and italics for that custom font. But I am unable to achieve it. For default font i am able to achieve it but for custom font i couldn’t. Is it possible to achieve it. The code snippet is provided below: […]

By T Eswaran
Categorised as Uncategorised Tagged , , ,

Adjust letter spacing in iOS 7

In iOS 7, when navigating back using the new swipe-from-edge-of-screen gesture, the title of the Back button (“Artists”) fades from being pink (in the example below) and having regular font weight to being black and having bold font weight. It seems to me that the animation uses two different labels in order to achieve this […]

By wstr
Categorised as ios7, textkit, uilabel Tagged , ,

UILabel clipping italic (oblique) text at left and right edges of content ( iOS 6+)

Problem: UILabel may clip italic (oblique) characters and even scripts at the left and right edges. The following screenshot displays the issue. At the left edge, the descender of the ‘j’ is clipped; at the right edge, the ascender of the ‘l’ is clipped. I realize this is subtle, and not everyone is going to […]

By bilobatum
Categorised as autolayout, ios, ios7, uilabel Tagged , , ,

How do I locate the CGRect for a substring of text in a UILabel?

For a given NSRange, I’d like to find a CGRect in a UILabel that corresponds to the glyphs of that NSRange. For example, I’d like to find the CGRect that contains the word “dog” in the sentence “The quick brown fox jumps over the lazy dog.” The trick is, the UILabel has multiple lines, and […]

By bryanjclark
Categorised as ios, ios7, textkit, uilabel Tagged , , ,

Calculating number of lines of dynamic UILabel (iOS7)

There are many solutions to this questions arround but couldn’t find non-deprecated one. I have an UILabel with mode WordWrap and fixed width of, let’s say 250. Lines are set to 0. Here is what I tried: UILabel *contentLabel = (UILabel*)[contentView viewWithTag:10]; CGSize size = [contentLabel.text sizeWithFont:contentLabel.font forWidth:contentLabel.frame.size.width lineBreakMode:NSLineBreakByWordWrapping]; NSLog(@”Label’s height is: %d”, size.height); The […]

By Jacek Kwiecie
Categorised as ios, ios7, uilabel Tagged , ,

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us