【问题标题】:UITextView xib loses formatting in IOS 5.1UITextView xib 在 IOS 5.1 中丢失格式
【发布时间】:2013-08-31 12:56:20
【问题描述】:

我使用带有单个 UITextView 的 xib 来显示预格式化的文本页面。在代码中格式化文本太复杂了,所以我在 Apple Pages 中进行格式化,然后将格式化的文本粘贴到 xib 的 UITextView 对象中。我在这样的页面中加载这个 xib

subviewArray = [[NSBundle mainBundle]
loadNibNamed:[language stringByAppendingString:_textXibName]
       owner:self options:nil];
textView = [subviewArray objectAtIndex:0];
textView.delegate=self;
textView.editable=NO;
textView.frame = CGRectMake(_textOrigin.x , _textOrigin.y , textView.frame.size.width, textView.frame.size.height);
[self.vignetteView addSubview:textView];

image xcode xib http://jonathan-thebook.com/x1_xcode.png
在 IOS 6.1 中,一切看起来都很完美。
screen shot in iOS 6.1, looking OK http://jonathan-thebook.com/x1_right_6.1.png
但是在 5.1 及以下的所有格式中突然丢失了!
screen shot in iOS 5.1, formatting is lost http://jonathan-thebook.com/x1_wrong_5.1.png
从哪里开始挖掘?也许是因为我处于轻微的恐慌状态,我不知道!任何建议都非常感谢!

【问题讨论】:

    标签: objective-c xcode uitextview ios5.1 ios6.1


    【解决方案1】:

    UITextViewUITextField 在 iOS 6 中添加了对使用属性字符串的样式文本的支持。iOS 5 中的最佳选择是使用 HTML 和 UIWebView

    见:https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS6.html#

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-19
      • 1970-01-01
      • 2010-10-19
      • 2019-11-11
      • 2014-09-27
      • 2021-07-24
      • 2023-01-31
      • 2015-05-21
      相关资源
      最近更新 更多