示例#1
0
        public static NSTextField CreateLabel(string text, NSFont font = null, NSTextAlignment alignment = NSTextAlignment.Left, bool translatesAutoresizingMaskIntoConstraints = false)
        {
            var label = new NSTextField()
            {
                StringValue     = text ?? "",
                Font            = font ?? ViewsHelper.GetSystemFont(false),
                Editable        = false,
                Bordered        = false,
                Bezeled         = false,
                DrawsBackground = false,
                Selectable      = false,
                Alignment       = alignment
            };

            label.TranslatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints;
            return(label);
        }