Uilabel

The UILabel class implements a read-only text view in iOS

Uitextview

The UITextView class implements the behavior for a scrollable, multiline text region in iOS



Right bigger inherent

Example

"Uilabel does not have any inherent padding applied;uitextview has padding that nsstring s drawing methods do not have"

from question  

UITextView breaking line to early

"I think the problem happened because the padding left right of uitextview is bigger than uilabel"

from question  

How to calculate TextView height base on text

Others

Example

I tested above code with about 4000 string rendered into 100 different widths and all results were equal to the uilabel i used for comparison;i did the same to calculate dimensions of uitextview which is more complicated and required to set up an nslayoutmanager

from question  

IOS how to determine the size of UILabel dynamically

Uilabel isn t built with textkit on ios7 at least not in a way that is accessible to developers;you d need to use uitextview to get access to textkit

from question  

What is the simplest way to set the line height of a UIlabel using TextKit in iOS 7?

But my suggestion is that instead of using multiple uilabel just concentrate on nsattributedstring;find uicontrollers that draw nsattributedstring because uilabel uitextview do not support nsattributedstring

from question  

UILabel with two different color text

I m aware that uitextview is much more suitable for this as it implements uitextinput protocol which has all the methods i need but due to a bug in ios i m limited to uilabel

from question  

Is there any way to get CGRects for NSRange in UILabel?

Apple changed uilabel to pull down orphan words so even if you get the lines right a uilabel may not give you the look of what you are doing since it could pull a word down;use a uitextview and disable scroll editing disabled and possibly selection disabled

from question  

Dynamic label text with space between lines + custom width of line

My problem is uitextview is more complicated than uilabel

from question  

How to Assert TextView value in XCode7 iOS9?

In my situation using the uibutton was the best solution because i had a simple single line text i didn t want to use uiview as a container for uilabel i wanted to simplify math calculations for autolayout in my cell i didn t want to use nsparagraphstyle because tailindent works incorrect with autolayout width of uilabel is smaller than expected i didn t want to use uitextview because of possible side effects i didn t want to subclass uilabel less code fewer bugs that s why using the contentedgeinsets from uibutton in my situation become the easiest way to add text margins

from question  

UILabel text margin

Uilabel are not editable however you can detect a touch with a uilabel or it s superview;when you detect the touch on the uilabel you simply restore the hidden uitextview and restore the string you saved

from question  

String length with given font to fit UITextView

Uilabel doesn t support selecting and copy;uilabel is derived from uiview but uitextview is derived from uiscrollview

from question  

UITextView vs UILabel: With respect to line-spacing

If you want to use sizewithfont it works fine for uilabel but not necessary with uitextview;uitextview is a subclass of uiscrollview and you should use content size after you set up a text to get the size

from question  

UITextView within UIScrollView - Dynamic Heights?

There my uilabel were localized properly on the device not in the simulator;however my uitextview did not get localized which took me another 30 minutes to figure out

from question  

Xcode 6: iOS doesn't use storyboard localizations

Also consider using uilabel instead of uitextview if you don t need to edit information inside since uitextview take longer to allocate and init and are generally slower than uilabel

from question  

UITextView how to cut off text

Uilabel is a view uitextview is a view too the method boundingrectwithsize is not the same thing as a view frame is just the bounding rect to contain that text;as suggested by aaron uitextview contains padding while uilabel not

from question  

UITextView vs UILabel height calculation

For this you might want to consider using uitextview instead of uilabel which doesn t give you access to how it manages layout the text;by disabling editing selection and scrolling uitextview behaves roughly the same as a uilabel except some padding you have to remove

from question  

Add a tap gesture to a part of a UILabel

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0