我已经使用了CATextLayer显示粗体和正常文本together.Now一段时间,我收到来自Web服务的响应长的文本,所以我不能够显示完整的text.Can任何一个请帮我应该是什么使CATextLayer对象的方式滚动像textview.Please建议我关于this.I也从取参考任何解决方案在这里 ,但它不是为我工作。 我使用此代码:
/ *按需创建文本层* /
if (!_textLayer) {
_textLayer = [[CATextLayer alloc] init];
//_textLayer.font = [UIFont boldSystemFontOfSize:13].fontName; // not needed since `string` property will be an NSAttributedString
_textLayer.backgroundColor = [UIColor clearColor].CGColor;
_textLayer.wrapped = YES;
//CALayer *layer = self.navigationController.toolbar.layer; //self is a view controller contained by a navigation controller
_textLayer.frame = CGRectMake(5,325, 310, 90);
_textLayer.contentsScale = [[UIScreen mainScreen] scale]; // looks nice in retina displays too :)
_textLayer.alignmentMode = kCAAlignmentJustified;
_textLayer.masksToBounds = YES;
[self.view.layer addSublayer:_textLayer];
}
说到底我也试过我_textLayer增加的UITextView的层以及代替self.view.layer。
请建议我怎么能实现这个功能吗?