开发者

Is there a CoreText equivalent for the iPhone SDK?

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 开发者_如何学Gothe paragraph. UITextfield is overkill for this I think.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜