uitextview 字體不隨 fontWIthName 改變 (uitextview font not changing with fontWIthName)


問題描述

uitextview 字體不隨 fontWIthName 改變 (uitextview font not changing with fontWIthName)

I'm trying to change the font for a UITextView with textview.font = [UIFont fontWithName:etc]; But for some reason it isn't doing anything and it always displays the same font and size. Here's the code: 

UITextView *descriptionTextView = [[UITextView alloc] initWithFrame:rect];
descriptionTextView.editable = NO;
descriptionTextView.scrollEnabled = NO;
descriptionTextView.text = description;
titleTextView.font = [UIFont fontWithName:@"Veranda" size:17.0]; //<‑ this line isn't working
[cell.contentView addSubview:descriptionTextView];

Any idea what the probem might be?

Thanks a bunch!

‑‑‑‑‑

參考解法

方法 1:

May be the error in that you change font of other text field? You operate with textview named 'descriptionTextView', but change font of 'titleTextView'

Or that default font is named "Verdana", not "Veranda"

(by Hash88Mikhail)

參考文件

  1. uitextview font not changing with fontWIthName (CC BY‑SA 3.0/4.0)

#uitextview #iOS #XCode #fonts






相關問題

textViewDidBeginEditing 由於縮放而未觸發 (textViewDidBeginEditing not firing due to zoom)

如何在 UITextView 下添加 UIImageViews(UITextView 跨越整個屏幕) (How do you add a UIImageViews under a UITextView (the UITextView spans entire screen))

UITextView tidak mengaktifkan textViewDidChange pada perubahan atribut? (UITextView not firing textViewDidChange on attribute change?)

向 UITextView 的框架添加陰影 也向文本添加陰影 (Add shadow to frame of UITextView add also shadow to text)

uitextview 字體不隨 fontWIthName 改變 (uitextview font not changing with fontWIthName)

帶有自己的 UIToolbar 的 UITextView 和 UIPickerView (UITextView and UIPickerView with its own UIToolbar)

為什麼 UITextView 的 text 屬性使用字符串而不是可變字符串? (Why does UITextView use string rather than mutable string for its text property?)

UILabel 中的多行文本 (Multiple lines of text in UILabel)

如何在 iPhone 的 UITextView 中嵌入鏈接 (How to embed a link in a UITextView for the iphone)

UITextView - 修改選定的文本 (UITextView - modifying selected text)

如何以編程方式將鍵盤視圖從“符號”重置為“字母” (How to reset keyboard view from 'symbols' to 'alphabet' programmatically)

UITextView 不會更改 textColor 屬性 (UITextView does not change textColor property)







留言討論