1
Я использую CATextLayer для рендеринга NSAttributedString. Когда это делается в этом методе, цвет не отображается правильно. Когда это делается с использованием CTStringAttributes, цвет работает, но NSAttributedString не знает своего собственного размера. Это код, я использую:Показать NSAttributedString с использованием CATextLayer в Monotouch
var caTextLayer = new CATextLayer();
var attributedString = new NSAttributedString
(
"test string",
ForegroundColor = UIColor.Blue.CGColor,
Font = new CTFont ("Arial", 24),
KerningAdjustment = 72f
);
caTextLayer.AttributedString = attributedString;
caTextLayer.Frame = UIScreen.MainScreen.Bounds;
caTextLayer.ContentsScale = UIScreen.MainScreen.Scale;
myViewController.View.Layer.InsertSublayer(layer3, 1);
caTextLayer.SetNeedsDisplay();
CTStringAttributes представит другие вопросы. Ссылка ниже, поскольку NSAttributedString не сможет узнать свой собственный размер. http://stackoverflow.com/questions/17814420/cannot-access-string-size-after-setting-ctstringattributes-font – CubanAzcuy