From e29de9af8f507d288a61d9459fb3d1f72976876f Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 18 五月 2020 10:40:08 +0800
Subject: [PATCH] 2020-05-18-1
---
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