tags:

views:

55

answers:

2

Is there a CoreText equivalent for the iPhone SDK? I just need to draw a paragraph of text and programmatically align it to the center of the screen based on the height of the paragraph. UITextfield is overkill for this I think.

A: 

I"m not sure you need core text, you can use

CGSize cs = [theString sizeWithFont:[UIFont systemFontOfSize:fontSize] constrainedToSize:CGSizeMake(width,FLT_MAX) lineBreakMode:UILineBreakModeWordWrap];

to get the height of the paragraph. Aligning it with that info should be pretty easy.

Andiih
+1  A: 

Core Text is available from iOS 3.2 and is including in iOS 4.0. For details, look at the Core Text Programming Guide.

xmr