Questions tagged [uilabel]

The UILabel class implements a read-only text view in iOS. You can use this class to draw one or multiple lines of static text, such as those you might use to identify other parts of your user interface. The base UILabel class provides support for both simple and complex styling of the label text. You can also control over aspects of appearance, such as whether the label uses a shadow or draws with a highlight.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Dynamic Resizing of UILabel Based on Text Content

Due to some of the data from the API being in the form of long lines and some being short, there is sometimes a significant gap between two labels. I tried the following method to resolve this issue, ...
Dilan's user avatar
  • 7
-1 votes
0 answers
42 views

How to prevent UILabel from clipping text?

Our font has some characters extending beyond its line, especially in an Arabic locale. UILabel clips these characters. I need to create a view that perfectly matches a Figma text component in terms ...
Данил Войдилов's user avatar
0 votes
1 answer
77 views

Content hugging and content compression resistance with minimum margin between views

I was trying to create a UI with two labels placed horizontally in parallel to other edges on the screen so that they can grow according to the content they receive. and I tried setting up content ...
Maverick's user avatar
0 votes
0 answers
99 views

UITextView causes abnormal number of gesture recognizer dependencies

I have a view that has several UITextViews, e.g. var notesTextView: UITextView = { let textView = UITextView() textView.textColor = Colors.blackText textView.font = Fonts.body textView....
Moses Harding's user avatar
0 votes
1 answer
12 views

how to have "hour", "minute", "second" text behind UIPickView

I'm making an app with a countdown timer feature. I want to show UIPickView like this.enter image description here And this is my app enter image description here I tried using UIDatePicker but it ...
Johnny Nguyên's user avatar
0 votes
2 answers
73 views

Why UILabel giving extra padding in swift?

I am using UILabels in UITableViewCell My code is below, I don't know why it gives the padding ? cell.lbl1.text = "Name - " cell.lbl2.text = "Class - " ...
Amit's user avatar
  • 599
0 votes
1 answer
53 views

Allow label to use preferred width necessary to not character wrap (when word wrap is enabled)

I have a UILabel with three lines set to word wrap. I also set the label to have a width of 180. While this works in almost all circumstances, some languages with very long words are starting to ...
Olivia Brown's user avatar
1 vote
1 answer
82 views

How can I get the x, y, width and height parameters of the text inside the UILabel?

I'm trying to use RectangleCountour library to make a rounded rectangles with rounded corners between lines behind all the text strings separately in UILabel. The parameters (x, y, width and height) ...
Pql's user avatar
  • 11
1 vote
1 answer
40 views

How to rotate the contents in a label?

I am working in an app which has only portrait support. I need to show a label in landscape orientation so I rotated the text in the label. But the position of the label gets changed. How to rotate ...
jerfin's user avatar
  • 843
0 votes
1 answer
466 views

Swift UI center text below label and icon

How can I center text below my labels and icons? Every time I add text below each label the labels and icons are shifted. What am I missing? For example: Text("sub title text&...
adalovelacy's user avatar
0 votes
1 answer
42 views

How do I Truncate middle of String based on conditions in UILabel in Swift iOS?

I have a String like this : AU 6,7,8,9,10,11,...,20,21,22,23,24,25 refer this image I have to fill only 8 sizes. This sizes have no limit they can be more than 20 or 50 also. If there are only 8 sizes ...
Dimpy-iRoid's user avatar
1 vote
0 answers
51 views

Multi line Large Title shows only first line in navigation bar with back button

Please tell me how to add a multi-line title in the navigation bar with a back button for iOS 16.4. I have already read all the discussions on Stack Overflow regarding similar topics. I have tried ...
Aysen  Eremeev's user avatar
1 vote
3 answers
103 views

UILabel.text is overlapping on change

I have a simple UIViewController with UILabel and UIButton: class MyScreen: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .blue ...
Roman Podymov's user avatar
0 votes
0 answers
56 views

How to get the truncating index in UILabel in swift

How to get the truncating index in UILabel without ellipsis (...). I Have a big text content and I want to break it according to screen size and show to the next horizontal page using CollectionView. ...
Supriyo Dey's user avatar
0 votes
2 answers
74 views

How To Expand UITableViewCell's UILabel's Background Property When Text Is Being Generated?

I cannot get my label's background property to properly expand/grow with the text as it is being inputted into the label. I've made a UITableView with a custom cell. This custom cell's file is a .xib ...
nascent_swifter's user avatar
1 vote
2 answers
42 views

How to obtain an approximately square multiline UILabel using Autolayout

I'm putting a multiline UILabel into a popup. The text has a variable length. What I'd really like to do is get a size that is approximately square—so that when displayed it has a nice appearance. If ...
David H's user avatar
  • 41k
2 votes
1 answer
406 views

UILabel View with rounded corner radius does not work on iOS 17 Beta - Xcode 15 Beta

I am using a UILabel view and I have set the corner radius of it so as to make it rounded using runtime attributes. This is how it appears on iOS 16.x or below (any iOS 16 or below). and this is how ...
Abhishek C. Gidde's user avatar
0 votes
0 answers
36 views

Xcode Localizable String Problem - everything is bold [duplicate]

I want to translate my app to different languages with localizable strings and it worked so far. My problem is I have very long texts in my app and in the translated version everything of the UILabel ...
wiwihello's user avatar
1 vote
0 answers
20 views

Swift hyperlink with UILabel [duplicate]

I like to ask if we can do hyperlink with UILabel, I know that we can do it with TextView. But my situation is that I have UILabel and I need to click on a specific text to go to another page or a ...
Alex171's user avatar
  • 37
-1 votes
1 answer
62 views

How do I add a typing animation to the text in my UITableViewCell?

I haven't worked with UITableViews before, and so I'm new to the animation effects you can have with UITableViews and UITableViewCells. Though, I'm not deterred. So how would I go about coding a ...
nascent_swifter's user avatar
0 votes
1 answer
54 views

How can I make dot in calculator app to use once in a number

I have a problem with my calculator app (which is done from the course). App is finished but at the end of a day when I press the number, then dot for decimal places and again dot app crashes. Also ...
Dayvy11's user avatar
0 votes
1 answer
55 views

2 UILabels placed horizontally in a table view cell

I am working on a table view and in the cell I need to create 2 labels horizontally. The first label has fixed content "Location Name:". The second label will have dynamic content and it can ...
Alex171's user avatar
  • 37
0 votes
1 answer
26 views

Random errors when embedding UILabel in UIView inside UIStackView

One UILabel is placed directly into UIStackView the second UILabel is the same but embedded in another UIView: I need >= constraint due to some more complex layout but I simplified the example. ...
Gargo's user avatar
  • 1,179
-1 votes
2 answers
283 views

iOS swift displaying image with text on uilabel

In my app i need to display the text content along with image in UILabel like this but i am only able to display text along with image like this text string in UILabel is starting from the bottom of ...
Abhinandan Pratap's user avatar
0 votes
0 answers
8 views

Get a UILabel from Storyboard programmatically without viewWithTag or IBOutlet

I got an UILabel from my Storyboard using the "viewWithTag" programmatically, but I want to know if is it possible to get this UILabel using a string from "restorationIdentifier" ...
fabiobh's user avatar
  • 715
-1 votes
1 answer
50 views

UILabel Splits Text String onto Multiple Lines

I have a UILabel with a fixed width and height. I've set a minimum font scale for the autoshrink property and truncate tail as the line break property. The lines property is set to 0. (Appended image ...
Chris's user avatar
  • 539
0 votes
0 answers
128 views

Issues with ActiveLabel.swift

I am using "ActiveLabel.swift" from github. It seems when I create a UIViewRepresentable there is always space above or below the text: There is very large space above "Hashtag test...&...
PickleCat's user avatar
0 votes
0 answers
78 views

UIViewRepresentable and UILabel resizing behaviour

I'm building a UILabel based SwiftUI view using UIViewRepresentable on an app that has a minimum deployments target set to iOS 14. The code of the View is: struct MyLabel: View { @State private ...
Luca Bartoletti's user avatar
0 votes
1 answer
361 views

How to have UITextField allow only integers And Maximum 10 digit with Swift 5?

How to have UITextField allow only integers And Maximum 10 digit. Can Anyone Help Me. Hear Is My Code: func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, ...
Jenil Naliyadhara's user avatar
0 votes
2 answers
69 views

UILabel font size fit label width

type swift label.font = UIFont(name: "NanumBarunGothic-YetHangul", size: 10) label.numberOfLines = 0 label.minimumScaleFactor = 0.5 label....
Cook Kim's user avatar
0 votes
0 answers
24 views

How do I print the UserDefaults information Label ? Swift

application welcome on first startup hello on next startup. I tried using Scene Delegate UserDefaults but I can only print in console because I don't know exactly. I want the SplashViewController ...
LordGrim's user avatar
1 vote
1 answer
51 views

Display UIStepper's value instead of minimumValue in UILabel at app's launch

I have a UIStepper with the following parameters: value: 40 minimumValue: 35 maximumValue: 45 I want to update the UILabel (linked to it) at app' launch in order to make the it displays value. It's ...
dorianDevTech's user avatar
0 votes
1 answer
218 views

UIButton title expansion limits [duplicate]

I'm having a trouble for controlling the title expansion limits of UIButton with the UIButtonConfiguration. Here is the setup code of my button: private lazy var button: UIButton = { let btn = ...
Murad's user avatar
  • 3
0 votes
0 answers
24 views

Round edges and shadow not working concurrently with UIView + UILabel inside in Swift [duplicate]

I am trying to create a custom UIVIew-based display box for my app in the form of a "badge" with a title "My name is..." and an empty gray area underneath. I am using Swift with ...
atrdeveloper's user avatar
0 votes
2 answers
164 views

Show Hide for UILabel over constraint not working as expected for height constraint

I have UILabel which I am showing and hiding on tapGesture. I have created label programatically and set constraint programatically only. by default UILabel is visible with heightConstraint = 230 on ...
Sagar's user avatar
  • 1,296
0 votes
0 answers
23 views

CAGradient not showing when locations are <0 or >1

I am trying to make a label with an animated gradient as its colour. I can get a static gradient just fine. I was playing around with animated gradients in a view with the intention of using a mask ...
justingiffard's user avatar
0 votes
0 answers
27 views

How To Detect If There Is a Link in UILabel Text?

private lazy var contentLabel: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false label.font = .regularDMSans(of: ThreadDetailConstants....
Miaperolla's user avatar
1 vote
4 answers
934 views

UIButton Configuration Line Break Mode Not Working

I know there are a few SO posts about this, but none are working... I am just trying to get my custom UIButton subclass using the UIButton.Configuration method to force my title label to stay 1 line, ...
Will Von Ullrich's user avatar
1 vote
1 answer
29 views

Typewriter Effect UILabel width issue

I want to have a UILabel in the middle of the screen that starts from the left of the screen. The UILabel will get updated every second from a Timer to simulate a typewriter effect. So to display &...
Ziad Halabi's user avatar
0 votes
0 answers
21 views

Highlighting single vowel/consonant from Korean (Hangul) alphabet in UILabel/SwiftUI Text

Is there any way to highlight (bold, change color etc) a single vowel/consonant in the Korean word? Let's say I want to highlight character ᄉ (s) in a word 삼 (sam). I thought that I can wrap the ...
mikro098's user avatar
  • 2,203
0 votes
0 answers
53 views

How to vertically center individual characters of a text string?

I am working on an iPhone app (Swift and Storyboard) and I would like to show some text, e.g. the price of a product people can buy, inside a box, as shown in the image. Nothing special, just an image ...
Ronnie de Rakker's user avatar
0 votes
0 answers
61 views

UIbutton inside UILabel text

I am trying to design a UIlabel with clickable UIButton's inside like in the image below. The idea here is that I am getting some text which contains some markers and when that marker appears I have ...
Madu's user avatar
  • 4,889
1 vote
0 answers
531 views

SwiftUI: Attributed string from HTML that wraps

I have two strings that can contain HTML strings. HTML string can only contain simple text formatting like bold, italic etc. I need to combine these in an attributed string and show in a list. Every ...
Olcay Ertaş's user avatar
  • 6,057
0 votes
1 answer
55 views

How to get resizing of UILabel objects with constraints to animate smoothly?

I have a vertical rectangle -- a simple UIView -- that is divided into 4 sections, sort of like a pie chart, and each section will grow and shrink dynamically (as data rolls in), and I'm trying to get ...
Alyoshak's user avatar
  • 2,696
0 votes
0 answers
24 views

How to update a ULabel which is in a viewController from a custom UICollectionViewCell in swift [duplicate]

I have a custom UICollectionViewCell which has buttons and images which feeds my collectionView. When a button is clicked I want to my label which serves as a counter to be updated class ...
KwameB's user avatar
  • 1
0 votes
1 answer
116 views

Dynamically Create Labels using Swift

I'm writing a score keeping app for a game and I'd like the players to be able to record multiple stats for games that could have 4, 6, 8 or even more players. I set up my labels as shown below: ...
Dominick's user avatar
  • 172
0 votes
1 answer
40 views

How to get UILabel to center text vertically?

I am assigning some text into a UILabel to display a single character, a symbol, with a Unicode value. Nothing unusual. But it is not being centered vertically when displayed. I've fiddled with ...
Alyoshak's user avatar
  • 2,696
0 votes
1 answer
50 views

change height of TableViewHeader and included UILabel after button click

When I want to set a new long status by pressing the button, my profileStatusLabel height and TableViewHeader height as well don't change. P.S. sorry about my English, if there are some mistakes **...
Алан Хайманов's user avatar
0 votes
0 answers
52 views

Get the actual truncated string from label [duplicate]

I have a UILabel with an attributed string, where the content text is e.g. "abcdefghijklmnopqrstuvwxyz", and and the numberOfLines property is 2. For this scenario the label displays as ...
Mix's user avatar
  • 459
0 votes
1 answer
38 views

Arabic and English text together in same label or in alert message

I am getting message from backend which contain both Arabic string as well as englist string when i set that message on alert it looks same as attached SS. original message = "+966897845123 أدخل ...
user20935301's user avatar

1
2 3 4 5
142