uilabel interview questions
Top uilabel frequently asked interview questions
I want to display an image next to a UILabel, however UILabel has variable text length, so I don't know where to place the image. How can I accomplish this?
Source: (StackOverflow)
How can I make a multiline UILabel
in interface builder for iOS? I tried the UITextView
but it didn't quite suit my needs.
Source: (StackOverflow)
I can't seem to modify the font size of a UILabel with the following code:
itemTitle.font = [UIFont systemFontOfSize:25];
As i increase the number 25 to something greater, it seems to only add a top margin to the label, which consequently pushes the text down...so much so that the text gets cut off at the bottom or completely overflows.
i have another UILabel elsewhere with systemFontOfSize 25, and it's much smaller than the itemTitle text. What's going on? Isn't 25 supposed to be an absolute value? i am so confused on how to programmatically change font size of uilabels.
Source: (StackOverflow)
I have been searching this for hours but I've failed. I probably don't even know what I should be looking for.
Many applications have text and in this text are web hyperlinks in rounded rect. When I click them UIWebView opens. What puzzles me is that they often have custom links, for example if words starts with # it is also clickable and the application responds by opening another view. How can I do that? Is it possible with UILabel or do I need UITextView or something else?
Source: (StackOverflow)
Is it possible to reduce the gap between text when put in multiple lines in a UILabel? We can set the frame, font size and # of lines. I want to reduce the gap between the two lines in that label.
Source: (StackOverflow)
Is there a built in way to create round-cornered UILabels? If the answer is no, how would one go about creating such an object?
Source: (StackOverflow)
I'm currently looking at a UILabel with the property addMessageLabel.layer.cornerRadius = 5.0f;
On a device with iOS 7.0 installed, it has rounded corners. On a device with iOS 7.1 installed, it does not have rounded corners.
Is this just a bug with iOS 7.1?
Source: (StackOverflow)
Is there a way to have multiple lines of text in UILabel
like in the UITextView
or should I use the second one instead?
Source: (StackOverflow)
Let see that I have a string look like this:
NSString *longStr = @"AAAAA\nBBBBB\nCCCCC";
How do I make it so that the UILabel display the message like this
AAAAA
BBBBB
CCCCC
I dont think \n
is recognized by UILabel, so is there anything that I can put inside NSString so that UILabel knows that it has to create a line break there? Thank you very much in advance.
Source: (StackOverflow)
I'm looking to set the left inset/margin of a UILabel and can't find a method to do so. The label has a background set so just changing its origin won't do the trick. It would be ideal to inset the text by 10px or so on the left hand side.
Source: (StackOverflow)
How am I supposed to configure programmatically (and in which method) a UILabel whose height depends on its text? I've been trying to set it up using a combination of Storyboard and code, but to no avail. Everyone recommends sizeToFit
while setting lineBreakMode
and numberOfLines
. However, no matter if I put that code in viewDidLoad:
, viewDidAppear:
, or viewDidLayoutSubviews
I can't get it to work. Either I make the box too small for long text and it doesn't grow, or I make it too big and it doesn't shrink.
Source: (StackOverflow)
I just upgraded to xcode 4.5 with iOS 6.0 and it's highlighting a warning on all the UILabels in my XIB files saying "minimum font size deprecated on ios version 6.0". Does anyone know what this is referring to and how to fix it?
Update:
image is no more available (was at https://skitch.com/hahmadi82/eyk51/cloud)
Source: (StackOverflow)
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 be at the top of the UILabel
?

Source: (StackOverflow)