原始地址:IOS开发之文本复制
本文基于富文本:DTCoreText
#import <Foundation/Foundation.h>
#import <MobileCoreServices/UTCoreTypes.h>//添加此框架
@interface UIPasteboard (AttributedString)
- (void) setAttributedString:(NSAttributedString *)attributedString;
@end
#import "UIPasteboard+AttributedString.h"
@implementation UIPasteboard (AttributedString)
- (void) setAttributedString:(NSAttributedString *)attributedString
{
//\ufffc为对象占位符,目的是当富文本中有图像时,只复制文本信息!!!
NSString *htmlString = [[attributedStrin