From 1a4b95a7ebef71838bd3eda2c22056bbf0db65ec Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 10 一月 2020 16:39:54 +0800 Subject: [PATCH] 2019阶段备份 --- Shared.IOS/UI/Button.cs | 59 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 49 insertions(+), 10 deletions(-) diff --git a/Shared.IOS/UI/Button.cs b/Shared.IOS/UI/Button.cs index f029376..4cba332 100644 --- a/Shared.IOS/UI/Button.cs +++ b/Shared.IOS/UI/Button.cs @@ -2,6 +2,7 @@ using Foundation; using Shared.IO; using System; +using CoreGraphics; namespace Shared { @@ -101,6 +102,42 @@ } /// <summary> + /// 鏄惁鏄剧ず绮椾綋 + /// </summary> + bool isBold; + public bool IsBold + { + get + { + return isBold; + } + set + { + isBold = value; + if (isBold) + { + iosButton.TitleLabel.Font = UIFont.FromName("Helvetica-Bold", mTextSize); + } + else + { + iosButton.TitleLabel.Font = UIFont.FromName("Helvetica", mTextSize); + } + } + } + + /// <summary> + /// 鑾峰彇瀛椾綋闀垮害 + /// </summary> + public int GetTextWidth() + { + int textWidth = 0; + CGSize fontSize = this.Text.StringSize(iosButton.TitleLabel.Font); + textWidth = (int)fontSize.Width; + + return textWidth; + } + + /// <summary> /// 鍒涙柊闇�瑕佸垱鏂扮殑淇℃伅 /// </summary> public override void Refresh() @@ -109,11 +146,12 @@ IsSelected = isSelected; } - /// <summary> - /// 鏂囧瓧澶у皬,榛樿12 - /// </summary> - /// <value>The size of the text.</value> - public float TextSize + float mTextSize = Application.FontSize; + /// <summary> + /// 鏂囧瓧澶у皬,榛樿12 + /// </summary> + /// <value>The size of the text.</value> + public float TextSize { get { @@ -121,6 +159,7 @@ } set { + mTextSize = value; iosButton.TitleLabel.Font = UIFont.FromName(FontName, value); } } @@ -154,11 +193,11 @@ } uint selecteTextColor = 0xFFFFFFFF; -/// <summary> -/// 鏂囧瓧棰滆壊 -/// </summary> -/// <value>The color of the text.</value> -public uint SelectedTextColor + /// <summary> + /// 鏂囧瓧棰滆壊 + /// </summary> + /// <value>The color of the text.</value> + public uint SelectedTextColor { get { -- Gitblit v1.8.0