Monday, 11 January 2016

Add Curved text in Objective C

In this tutorial, i will tell you about how to add curved texts in your application to make it look better.


For adding Curved Texts in your application do the following steps :

Step 1.     Go to curved text sample in the github and download the file.

Step 2.     From the downloaded sample, drag CoreTextArcView.h , CoreTextArcView.m to your project and check copy to destination folder.

Step 3.     Import CoreTextArcView.h in your ViewController.m.

Step 4.      Turn off arc of the CoreTextArcView.m by go to Build Phases >> Compile sources and turn off arc by typing fno-objc-arc

Turn off arc


Step 5.     Add the following code in your viewDidLoad to add curved text :







Your final output will be :


Result
Here is your curved label .

Thanks :)

10 comments:

  1. Nice sample for understand , I like it. I have one question , To use this sample app can we draw text without arch.
    If I am using arh is 0 then text are shrinking Please suggest , What i can get horizontal text.

    ReplyDelete
  2. Hi Tikam ,

    Thanks for reading .

    Is it necessary to give arc size ?
    Yes it is necessary to give arc size and radius because only then you ll be able to give curve to your text .

    ReplyDelete
  3. How we can draw horizontal text . After that I will give arch size from slider change.
    Please help me.?

    ReplyDelete
  4. Can you be more specific ?

    I didn`t get what you want ?

    ReplyDelete
  5. Actually I want draw a text it would be horizontal text . then when user change the slider it would be curve as per the slider value.

    ReplyDelete
  6. Thanks for Quick response . Did you get my points?

    ReplyDelete
  7. OK

    You have to change arc size as well as radius when you change your slider.

    arc size and slider values should be in proportion .

    ReplyDelete
  8. I am doing same. but still text are very shrink and characters are overlapping.

    ReplyDelete
  9. Hi Tikam , That can't be possible using this library . You have to find some other library for that .

    ReplyDelete