uilabel Questions

6

Solved

I'm trying to create a UILabel with padding in my Xamarin.iOS app. The most popular solution in native Objective-C apps is overriding drawTextInRect: - (void)drawTextInRect:(CGRect)rect { UIEdgeI...
Garcon asked 16/1, 2014 at 14:28

51

Solved

I have a UILabel with space for two lines of text. Sometimes, when the text is too short, this text is displayed in the vertical center of the label. How do I vertically align the text to always b...
Vamoose asked 28/6, 2009 at 8:54

11

Solved

Is there a straightforward way of overriding the titleView of the current navigation bar item in a navigation bar within a navigation controller? I've tried creating a new UIView and replacing the ...

5

Solved

Is there any way to reduce font size that can be fit in single segment of UISegmentedControl ? Have tried many thing something like, [[UILabel appearanceWhenContainedIn:[UISegmentedControl class]...
Appanage asked 22/7, 2016 at 7:6

26

Solved

Is there a way to have multiple lines of text in UILabel like in the UITextView or should I use the second one instead?
Greenfield asked 13/6, 2009 at 7:28

1

Solved

I have the following code to try to underline a label's string. let attributedString = NSMutableAttributedString(string: "Hello World!") attributedString.addAttribute(NSAttributedSt...
Testes asked 30/7, 2021 at 14:59

3

Let's say we have a UILabel, that is pinned from all sides to its superview. Number of Lines is set to 0 (so we can display multiline strings) and we use Truncate Tails strategy for line breaks. I...
Conidium asked 7/8, 2015 at 12:51

3

I want to update a text label after it is being pressed, but I am getting this error while my app runs (there is no compile error): [SwiftUI] Modifying state during view update, this will cause und...
Unilobed asked 10/8, 2019 at 14:10

6

Solved

I need the text of a UILabel to be black, but have a light gray underline under the text. Is this possible with NSAttributedString or TTTAttributedLabel? Or is custom drawing using Core Graphics ne...
Piling asked 15/3, 2014 at 5:24

9

Solved

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 "Th...
Mier asked 17/10, 2013 at 3:31

6

Solved

How can you rotate text for UIButton and UILabel? 90 degrees, 180 degrees. Note: Before you mark this as a duplicate, I am intentionally modelling my question as a Swift version of this one: How c...
Hardecanute asked 25/2, 2015 at 11:17

4

Solved

I am looking to draw a UILabel (preferable through subclassing) as a transparent label, but with solid background. I draw up an quick example (sorry, it's ugly, but it gets the points across :)). ...
Rusel asked 4/1, 2012 at 1:38

5

Solved

I am putting a label on a UIToolbar (per this tip: Adding a UILabel to a UIToolbar). But the toolbar has a button on the left side, and so flexible spaces throw the label off the center, which is ...
Polystyrene asked 24/3, 2010 at 20:26

5

iOS application, we're to display news, coming from server. UIlabel is used Everything is perfect when he sentence is in a single language only with no regard to layout (we're switching layout RT...
Control asked 28/5, 2016 at 9:59

7

Solved

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...
Steatite asked 13/9, 2013 at 10:33

5

Solved

I am trying to justify my UILabel text but it does not work. Declaration of my UIView: descriptionUIView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.h...
Lett asked 21/11, 2014 at 11:14

2

Solved

How can I animate a color change of UILabel using swift? I have seen people mention using CALayer but I cannot figure out the Swift syntax. This is an example of Objective-C CALayer *layer = myVi...
Krishnakrishnah asked 5/12, 2014 at 18:6

4

Solved

When I dynamically change the text of a UILabel I would prefer to get an ellipsis (dot, dot, dot) rather then have the text be automatically resized. How does one do this? In other words, if I hav...
Shriner asked 11/10, 2011 at 12:7

1

Solved

I found a solution for building a padded label here https://stackoverflow.com/a/58876988/826946 and saw an answer that uses IBInspectable to make it simple to use from InterfaceBuilder here: https:...
Lally asked 29/4, 2021 at 13:3

3

I have got a label and I spent quite a lot time trying to change the font of my UILabel to SF Rounded Bold. Things like titleLabel.font = UIFont(name: "SFRounded-Bold", size: 34.0) or titleLabel....
Pylorus asked 30/1, 2020 at 8:8

5

Solved

I have tried everything to auto-resize my UILabel in Swift. I can autoresize the text when it is one line but when it is two lines it no longer works. The text in the UILabel changes often happenin...
Hinze asked 18/5, 2017 at 3:18

7

Solved

I'm currently working on drawing vertical Chinese text in a label. Here's what I am trying to achieve, albeit with Chinese Characters: I've been planning to draw each character, rotate each char...
Calypso asked 9/3, 2012 at 3:50

3

Solved

Let's say I scale a UILabel using a CGAffineTransformScale like so: let scale = 0.5 text = UILabel(frame: CGRectMake(100, 100, 100, 100)) text.text = "Test" UIView.animateWithDuration(2.0, delay:...
Swayder asked 21/4, 2016 at 22:2

3

I have a UILabel carefully laid out in Interface Builder with proper height and width constraints. The number of lines is set to 4. The wrapping is set to word wrap. The text is "CHECKED". The font...
Cutty asked 19/3, 2017 at 19:10

9

Solved

I want to make sure the button text fits into a UIButton, while the UIButton has a fixed size. Of course I can access the titleLabel of the UIButton. In a label I would set autoshrink to minimum ...
Haustellum asked 14/9, 2015 at 9:31

© 2022 - 2024 — McMap. All rights reserved.