public void MutableCopy() { using (var s1 = new NSAttributedString("string")) { using (var copy = s1.MutableCopy()) Assert.That(copy.RetainCount, Is.EqualTo((nuint)1), "Copy retaincount 1"); using (var copy = ((INSMutableCopying)s1).MutableCopy(NSZone.Default)) Assert.That(copy.RetainCount, Is.EqualTo((nuint)1), "Copy retaincount 2"); } }
public override CGRect DrawTitle(NSAttributedString title, CGRect frame, NSView controlView) { if (TextColor != null) { var newtitle = (NSMutableAttributedString)title.MutableCopy(); var range = new NSRange(0, (int)title.Length); newtitle.RemoveAttribute(NSStringAttributeKey.ForegroundColor, range); newtitle.AddAttribute(NSStringAttributeKey.ForegroundColor, TextColor, range); title = newtitle; } var rect = base.DrawTitle(title, frame, controlView); return(rect); }
public override System.Drawing.RectangleF DrawTitle(NSAttributedString title, System.Drawing.RectangleF frame, NSView controlView) { if (TextColor != null) { var newtitle = title.MutableCopy() as NSMutableAttributedString; var range = new NSRange(0, title.Length); newtitle.RemoveAttribute(NSAttributedString.ForegroundColorAttributeName, range); newtitle.AddAttribute(NSAttributedString.ForegroundColorAttributeName, TextColor, range); title = newtitle; } var rect = base.DrawTitle(title, frame, controlView); return(rect); }