Linked Questions

17 votes
1 answer
15k views

Howto set different font size and color in a UILabel with Swift? I need to color the first char of the string with different color and size than the rest of the string.
lifeisfoo's user avatar
  • 16.6k
1 vote
1 answer
2k views

For example consider I have a button named Button and its title is "Hello" . How can I make the title red colored with a font size of 35? Thanks for all your answers in advance!
S.Shahsiah's user avatar
1 vote
0 answers
128 views

Let's say this is my label: @IBOutlet weak var hello: UILabel! I have these 2 variables: let greeting = "Hello, my name is" let name = "Bob" I want to update my label, so I do this: hello.text = "\(...
John R Perry's user avatar
  • 4,222
318 votes
14 answers
249k views

Multiple colours in an NSString or NSMutableStrings are not possible. So I've heard a little about the NSAttributedString which was introduced with the iPad SDK 3.2 (or around 3.2) and is available on ...
Brock Woolf's user avatar
  • 47.4k
129 votes
12 answers
78k views

I have a UITextView which displays an NSAttributedString. This string contains words that I'd like to make tappable, such that when they are tapped I get called back so that I can perform an action. I ...
tarmes's user avatar
  • 15.4k
129 votes
10 answers
163k views

In Objective-c we create range by using NSRange NSRange range; So how to create range in Swift?
vichhai's user avatar
  • 2,568
99 votes
12 answers
241k views

What is the name of the default system font on the iPhone? I would like to retrieve this for customizing a UIView.
Ken's user avatar
  • 31.3k
88 votes
8 answers
93k views

I was originally wanting to know how to make something like this UIColor.myCustomGreen so that I could define my own colors and use them throughout my app. I had studied extensions before and I ...
Suragch's user avatar
  • 516k
48 votes
15 answers
34k views

I am using titleForHeaderInSection to show a header for a UITableView section. It worked fine with the iOS6 SDK, but the iOS7 SDK shows the header in all CAPS. I guess it's part of Apple's updated ...
gbroekstg's user avatar
  • 1,185
48 votes
7 answers
23k views

Actually I love UILabel. They're sweet. Now I had to go to UITextView because UILabel is not aligning text vertically to the top. Damn. One thing I really need is a text shadow. UILabel has it. ...
dontWatchMyProfile's user avatar
52 votes
7 answers
86k views

Edit - This has been marked as duplicate, but as I state below, I am looking for a Swift solution. Everything I've found is written in Objective C. I am trying to convert HTML into an ...
Martin Muldoon's user avatar
42 votes
9 answers
39k views

I have a reference to NSAttributedString and i want to change the text of the attributed string. I guess i have to created a new NSAttributedString and update the reference with this new string. ...
Chirag Jain's user avatar
  • 2,418
20 votes
2 answers
11k views

I have an UIButton in my View that says "STOP". When pressed, it should (stop the playback, of course, and) change its label to "RTN TO ZERO". This is straightforward: stopButton.titleLabel.text = @"...
Joe Völker's user avatar
13 votes
6 answers
20k views

Do you have any ideas about line spacing with UITextView? I cannot apply it. Below it is my code. import UIKit class DetailViewController: UIViewController { @IBOutlet weak var itemTextView: ...
Ravy Chheng's user avatar
19 votes
4 answers
19k views

I just wanted to know how could i change the background color of an NSAttributedString, i can see the background being white all the time, but i want to make it black. Is that possible?? Many thanks!
albertosh's user avatar
  • 2,526

15 30 50 per page