black friday sale

Flat 10% off on the purchase of any two apps or more. Use coupon code - FESTIVAL10

Grab It Now
Check Mobile App
Read now
Start a Project

Change half or some text color of UILabel in Swift

Save

Change half or some text color of UILabel

Suppose you want to change the some text of your label  you always create two labels for that but its a wrong approach of changing text color of label.  You can use the NSMutableAttributedString for changing the some text color of your label.Firstly, you have to find the the range of text,which you want to change the color of that text and then set the range of your text to the  NSMutableAttributedString object  as compared to full string and then set your label attributedText with the NSMutableAttributedString object.Example :-

If you want to use this in many times in your application you can just create the extension of the UILabel and it will make more simple :-

Use your label:-

 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


1 comments

  • vikram
    Fabulous post.. really liked
  • css.php

    Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.

    Stathis Plakidas

    Stathis Plakidas

    Talk to Sales

    Global

    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home