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 , , , ,

Swift CVCalendar not updating monthLabel

I recently started using CVCalendar to create a CalendarView with a Week presentation. I created a UILabel called monthLabel which has an outlet to the view’s controller The ViewController for this particular view is this one: import UIKit import CVCalendar class EventsViewController: UIViewController { @IBOutlet weak var headerView: UIView! @IBOutlet weak var menuView: CVCalendarMenuView! @IBOutlet […]

By Frakcool
Categorised as cvcalendar, ios, swift, uilabel

Multiline UILabel on navigation bar title view

I have a custom UIView which has 2 UILabel (same width) and one UIImageView (known width of 44pt). Width sizes are given as an example, they can change but It is exact that UILabels should has same width and UIImage has a 44 point width. I want to add this view to UINavigationBar‘ titleView BUT […]

By Emre nder
Categorised as ios, swift, uilabel, uiview

NSLayoutManager returns incorrect character index when tapping on LTR text in RTL attributed text

I wrote code to detect if the user taps within a specific range in UILabel. It seems to be working in most cases, but I have noticed that tapping the last line of an attributed text creates inconsistent results. public static bool DidTapRange(this UITapGestureRecognizer recognizer, UILabel label, NSRange range) { using (var ts = new […]

By user246392
Categorised as ios, nslayoutmanager, uilabel, xamarin, xamarin.ios

Multilinelabel inside multiple stackviews inside UITableViewCell

I have view hierarchy like below; UITableViewCell -> -> UIView -> UIStackView (axis: vertical, distribution: fill) -> UIStackView (axis: horizontal, alignment: top, distribution: fillEqually) -> UIView -> UIStackView(axis:vertical, distribution: fill) -> TwoLabelView My problem is that labels don’t get more than one line. I read every question in SO and also tried every possibility but […]

By Emre nder
Categorised as ios, swift, uilabel, uistackview

UILabel, TextField with overstrike character

I want to create a UILabel or UITextField with an overstruck character. (not a strikethru dash)For example: is this possible in Swift 4/5 (Not SwiftUI). The hope is that this will roll into a text to show a correction and that the user adapting size will size as appropriate. Note, I referenced several other questions […]

By Dru Freeman
Categorised as ios, strikethrough, swift, uikit, uilabel

UILabel in UITableViewCell takes up extra space when set to fixed number of lines

I have a label inside a table view cell. I have set the label to a number of lines, 2. However, if the text is larger it takes up the space as if it had no line restriction and was displaying the full text. Even though it is displaying just two lines. Constraints for that […]

By steventnorris
Categorised as swift, uilabel, uitableview

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 , , ,
1 2

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