ios - <hr> 在 UITextView 中分离 [iOS]

标签 ios objective-c uitextview

有没有一种非常简单的方法来插入 <hr>在 UITextView 中分离?

我试过这样的东西,但它不是很漂亮:

[textToInclude appendString:[NSString stringWithFormat:@"________________________________________ \n Total: %0.3f", total]];
[self.myUITextView setText:textToInclude];

最佳答案

最后,由于这个 UITextView 是“只读的”,我使用了一个 UIWebView,这样做:

 NSString *contentView = [[NSString alloc] init];
 contentView = [NSString stringWithFormat:@"<html><body ><p style=\"color:grey; font-style:italic;\">Some datas</p><hr/><p style=\"font-size:14px;\">  Total: %0.3f </p></body></html>", total];
 [self.myUITextView loadHTMLString:contentView baseURL:nil];
 [self webViewDidFinishLoad:self.existingEntries];

关于ios - <hr> 在 UITextView 中分离 [iOS],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22481261/

相关文章:

ios - 导航 Controller 内的 UIWebView 在键入时崩溃

ios - 无法在 Xcode 中看到 Cocos2d 类的自动完成

ios - NSLayoutConstraint layout_Margin 从 iOS 7 到 iOS 8 的变化

ios - 检测底层 UITableViewCell 上的触摸并点击 UITextview 的属性文本

ios - UITapGestureRecognizer 不适用于 UITextField 的自定义子类

iphone - 如何在键盘存在时使 UITextView 向上移动

ios - 在 uitableview 中显示 vcard 数据

ios - 如何在 viewController 中扩展调用功能

objective-c - Objective-C 属性的解释

iphone - 在 Interface Builder 中设置带有 map View 的导航 Controller