Reputation: 10839
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.
Upvotes: 0
Views: 320
Reputation: 635
Core Text is available from iOS 3.2 and is including in iOS 4.0. For details, look at the Core Text Programming Guide.
Upvotes: 2
Reputation: 12413
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.
Upvotes: 1