簡體   English   中英

iOS 單擊時后退按鈕文本消失

[英]iOS back button text disappears when clicking

在使用 Xamarin 開發的 iOS 應用程序中,后退按鈕的行為很奇怪。 有時/很少單擊文本會使文本消失。 到 go 回到上一個屏幕,我必須點擊箭頭:

問題的屏幕記錄

我還注意到,當只按住文本而不釋放鼠標/手指時,文本總是消失:

按住

任何線索可能導致這種行為? 我不認為應用程序是使用 Xamarin 創建的這一事實應該在這里發揮重要作用 - 它都是本機 iOS 視圖控制器和視圖。

我想我找到了根本原因。 我通過創建新的UITextAttributesUIBarButtonItem.Appearance代理的主題中設置字體屬性:

var proxyUIBarButton = UIBarButtonItem.Appearance;
proxyUIBarButton.SetTitleTextAttributes(new UITextAttributes { Font = UIFont.FromName(RegularFontName, 20), TextColor = AtxBlue }, UIControlState.Normal);

它在基於默認屬性的屬性時起作用:

var attr = proxyUIBarButton.GetTitleTextAttributes(UIControlState.Application);
attr.Font = UIFont.FromName(RegularFontName, 20);
attr.TextColor = AtxBlue;
proxyUIBarButton.SetTitleTextAttributes(attr, UIControlState.Normal);

希望這可以幫助其他有同樣問題的人。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM