开发者

What code for the iPhone so the user can change the font size in text view by clicking some buttons?

How do I impl开发者_StackOverflowement code for the iPhone so the user can change the font size in text view by clicking some buttons? (UITextView usage)


Wire up the buttons to IBActions. Create your interface with an outlet for your UITextView (textView) and the current font size (fSize).

Within the IBAction put this code:

- (IBAction) fontPlusDown {
    fSize++;
    UIFont *newFont = [UIFont systemFontOfSize:fSize];
    [textView setFont:newFont];
}

Adjust the code for reduction (fSize--).


Use [textView setFont:[UIFont fontWithSize:yourdesiredSize]] when you tap on a button.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜