Convert NSMutableAttributedString to NSString Convert NSMutableAttributedString to NSString ios ios

Convert NSMutableAttributedString to NSString


You can't use a cast to convert an object from one type to another. Use the provided method:

label1.text = [string1 string];

Better yet, use the attributed string:

label1.attributedText = string1


NSAttributtedString includes a .string property. From there, you can take NSString without attributes.

So:

NSAttributtedString* someString;NSString* string = someString.string;


NSAttributtedString have a property string and it is read only property you can not change it.

NSAttributtedString* attributtedString;NSString* plainString = attributtedString.string;