Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the font size of UITextView?

Tags:

iphone

I have to set the font size and font family of a dynamically created textView, so that it gives same appearance as the one generated using Interface builder. Any idea how to do this?

like image 862
Ajayvictor007 Avatar asked Jun 16 '10 15:06

Ajayvictor007


3 Answers

UITextView *textView

...

[textView setFont:[UIFont fontWithName:@"ArialMT" size:16]]
like image 129
John Muchow Avatar answered Oct 26 '22 13:10

John Muchow


You try this

[textView setFont:[UIFont systemFontOfSize:15]];

or

[textView setFont:[UIFont boldSystemFontOfSize:15]];

or you want to give fontname and size then you try this

[textView setFont:[UIFont fontWithName:@"arial" size:16]]
like image 23
Waseem Shah Avatar answered Oct 26 '22 11:10

Waseem Shah


There is a property called font in UITextView,

@property(nonatomic, retain) UIFont *font

You can do like this:

 yourTextView.font = builderTextView.font
like image 42
vodkhang Avatar answered Oct 26 '22 13:10

vodkhang