Ari Porad
Ari Porad

Reputation: 2922

iOS - Curved Rounded UITextfield

I need to have a textfield in my app that is curved, I am able to pre-define the path.

I have an textfield in my storyboard, and when a button is tapped, a text field needs to appear in, but curved.

How Do I achieve the curved part, making the textfield round and the text curve as it is entered?

thanks, Ari

Upvotes: 1

Views: 545

Answers (1)

foundry
foundry

Reputation: 31745

You will need to write a hefty chunk of Core Text code + code to calculate curve geometry which essentially navigates your writing along a path.

Here are some good on/offline resources:

Eva Diaz-Santana, Core Text Tutorial
http://weblog.invasivecode.com/core-text

Rob Napier, iOS6 Pushing the Limits (Chapter 26, Fancy Text Layout)
http://iosptl.com/

Apple, CoreTextArcCocoa (sample code)
http://developer.apple.com/library/mac/#samplecode/CoreTextArcCocoa/Introduction/Intro.html

Erica Sadun, The Advanced iOS6 Developer's Cookbook (Chapter 3, Core Text and Chapter 4, Geometry - see especially Recipe 4.8, Laying out Text along a Bezier Path)
https://github.com/erica/iOS-6-Advanced-Cookbook

Upvotes: 3

Related Questions