Questions tagged [nsmutableattributedstring]
357 questions
-1
votes
1 answer
NSMutableAttributedString not working in ViewController but works in Playground
I have a problem with this code and I do not know what I am doing wrong. I tried everything in Playground first and it works like a charm. Assigning this to the UILabel it just not working.
let nameSurname = "\(postAddSetup.nameSurname.text!)"
let…

Marian Petrisor
- 262
- 2
- 19
-1
votes
2 answers
How the color of attributed text inherits the parent color?
For example I have to put a String "Hello, world!" in the UIButton.
And "Hello," and "world!" should be different colors.
"Hello," has the default color of UIButton, and "world!" has the customized color by NSMutableAttributedString.
I explain again…

Byoth
- 1,905
- 6
- 16
- 28
-1
votes
1 answer
UITextView not showing attributedString in Swift
When I run the code below the attributedText is displayed in the console but does not show up in the UITextView. I save the attributedText in a global variable scrollViewText. Ive tried printing scrollViewText but it still shows up as a blank space…

Junaid Javed
- 25
- 1
- 10
-1
votes
1 answer
Adding different alignment and font size to different lines in one TextLabel in TableCell swift
so i'm trying to implement a simple english to farsi dictionary in iOS
i'd like to include both words in one table cell, problem is that english is L>R and farsi is R>L, also i'd like to make the farsi word a bit bigger.
I created an…

hnaderi
- 409
- 8
- 16
-1
votes
3 answers
xcode iOS NSMutableAttributedString add attribute more than one time
I want to show the english date styled. I made the following code to get the characters to "redesign":
- (NSMutableAttributedString *)attributedInfoString:(NSString *)string;
{
NSMutableAttributedString *attString =…

Christian
- 506
- 4
- 14
-1
votes
1 answer
How to create attributed text in a UITableView?
So I have a class:
class BoatTypeGame: UITableViewController
The table view has 14 rows. From rows 1-7, I want to make the color of the text green and for rows 8-14, I want to make the color of the text red. By the way, the cells will not have the…

TheCentral
- 35
- 1
- 6
-1
votes
1 answer
Add attributed text hides UILabel
I'm trying to add a strikethrough to some of my labels.
My project supports 32 and 64 bit.
Everything works great on iOS 8, but on iOS 7 on iPhone 5c the label just disappear.
Here's my code:
NSMutableAttributedString *throughLineAttributeString =…

YogevSitton
- 10,068
- 11
- 62
- 95
-2
votes
1 answer
Swift: Refactoring NSMutableAttributedString
I have used NSMutableAttributedString/NSAttributedString here and there but don't have extensive experience with them. I have a code block that repeats itself and was wondering how would I go about refactoring it? I've been working on a few…

syds
- 322
- 3
- 12
-2
votes
4 answers
NSMutableAttributedString check nil value
I created a NSMutableAttributedString and I'm appending the value dynamically. I need to check if this string is nil or not. I manually assigned nil but still the condition below fails. Is there any way to check this?
attribStr =…

Vijay
- 355
- 1
- 5
- 19
-2
votes
1 answer
How to set different color for Alphabets in uilabel
I want to set gray color for alphabets in uilabel. how to set range value for that in NSMutableAttributedString.
Example :
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:@"1.2 Sun - 3.4 Mon"];
[attrString…

Sagar Surani
- 25
- 7
-3
votes
1 answer
Swift - search strings in TextView and make them bold
I have an UITextField with long text inside, I need to find all the occurrences of a string inside the text and make them bold.
I know I should use NSMutableAttributedString for making the text bold, but how can I search specific substring inside…

Szanownego
- 239
- 1
- 11
-3
votes
1 answer
How to append two NSMutableAttributeString in swift
how to join two NSMutableAttributeString into single NSMutableAttributeString in swift

rajes
- 251
- 2
- 4
- 8