Пример #1
0
		static CTFrame CreateFrame (LayoutInfo li)
		{
			if (string.IsNullOrEmpty (li.Text))
				return null;

			using (CTFramesetter framesetter = new CTFramesetter (CreateAttributedString (li))) {
				CGPath path = new CGPath ();
				bool ellipsize = li.Width.HasValue && li.TextTrimming == TextTrimming.WordElipsis;
				path.AddRect (new RectangleF (0, 0, li.Width.HasValue && !ellipsize ? li.Width.Value : float.MaxValue, li.Height ?? float.MaxValue));

				return framesetter.GetFrame (new NSRange (0, li.Text.Length), path, null);
			}
		}
Пример #2
0
        static CTFrame CreateFrame(LayoutInfo li)
        {
            if (string.IsNullOrEmpty (li.Text))
                return null;

            using (CTFramesetter framesetter = new CTFramesetter (CreateAttributedString (li))) {
                CGPath path = new CGPath ();
                path.AddRect (new RectangleF (0, 0, li.Width ?? float.MaxValue, li.Height ?? float.MaxValue));

                return framesetter.GetFrame (new NSRange (0, li.Text.Length), path, null);
            }
        }