jjzjj

NSAttributedText

全部标签

ios - NSAttributedText 字体大小根据 UILabel 宽度变化

我用这种方式创建了一个NSAttributedStringattribute3=[NSForegroundColorAttributeName:innercircleColor,NSFontAttributeName:UIFont.init(name:"Bariol",size:18.0)!]attriType=NSAttributedString.init(string:type,attributes:attribute3)lblType.setAttributedText(attriType)但根据我的UILabel大小,在iPhone5s中,此属性文本位于UILabel之外。如何

ios - 通过 NSAttributedText 使用的图标分辨率

我通过以下方式在NSAttributedString中使用图标:NSTextAttachment*textAttachment=[[NSTextAttachmentalloc]init];textAttachment.image=[UIImageimageNamed:@"notes-18w_18h.png"];NSAttributedString*attrStringWithImage=[NSAttributedStringattributedStringWithAttachment:textAttachment];[headerASreplaceCharactersInRange:N

html - 将 HTML 解析为 NSAttributedText - 如何设置字体?

我正在尝试获取一段以html格式设置的文本,以便在iPhone的UITableViewCell中很好地显示。到目前为止我有这个:NSError*error;NSString*source=@"Nicetry,Phil";NSMutableAttributedString*str=[[NSMutableAttributedStringalloc]initWithData:[sourcedataUsingEncoding:NSUTF8StringEncoding]options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType