public CTTextTab(CTTextAlignment alignment, double location, CTTextTabOptions options) { handle = CTTextTabCreate (alignment, location, options == null ? IntPtr.Zero : options.Dictionary.Handle); if (handle == IntPtr.Zero) throw ConstructorError.Unknown (this); }
public CTTextTab(CTTextAlignment alignment, double location, CTTextTabOptions options) { handle = CTTextTabCreate(alignment, location, options == null ? IntPtr.Zero : options.Dictionary.Handle); if (handle == IntPtr.Zero) { throw ConstructorError.Unknown(this); } }
public CTTextTab(CTTextAlignment alignment, double location) : this(alignment, location, null) { }
static extern IntPtr CTTextTabCreate(CTTextAlignment alignment, double location, IntPtr options);
public CTTextTab(CTTextAlignment alignment, double location) : this(alignment, location, null) { }
static extern IntPtr CTTextTabCreate(CTTextAlignment alignment, double location, IntPtr options);
void drawLabel(CGContext ctx, CGRect rect, nfloat yCoord, nfloat xCoord, CTTextAlignment alignment, UIColor color, string label, bool flipContext = true) { Console.WriteLine("Finish Draw code"); var attrString = new NSMutableAttributedString (label); var range = new NSRange (0, attrString.Length); var uiFont = UIFont.FromName("HelveticaNeue-Medium", range.Length > 1 ? 15 : 22); var font = new CTFont (uiFont.Name, uiFont.PointSize); //((uiFont.Name as NSString) as CFString, uiFont.pointSize, nil); var path = new CGPath (); var alignStyle = new CTParagraphStyle (new CTParagraphStyleSettings { Alignment = alignment }); var attributes = new CTStringAttributes { Font = font, ForegroundColor = color.CGColor, ParagraphStyle = alignStyle }; attrString.SetAttributes(attributes, new NSRange (0, attrString.Length)); var target = new CGSize (nfloat.MaxValue, nfloat.MaxValue); var fit = new NSRange (0, 0); var framesetter = new CTFramesetter (attrString); var frameSize = framesetter.SuggestFrameSize(range, null, target, out fit); var textRect = new CGRect (xCoord - (frameSize.Width / 2), yCoord - (frameSize.Height / 2), frameSize.Width, frameSize.Height); path.AddRect(textRect); var frame = framesetter.GetFrame(range, path, null); if (flipContext) { ctx.SaveState(); ctx.TranslateCTM(0, rect.Height); ctx.ScaleCTM(1, -1); frame.Draw(ctx); ctx.RestoreState(); } else { frame.Draw(ctx); } }
public CTTextTab(CTTextAlignment alignment, double location, CTTextTabOptions?options) : base(CTTextTabCreate(alignment, location, options.GetHandle()), true, true) { }