[英]UIBarButtonItem appearance proxy setting font attributes not working in iOS 11
似乎用於設置UIBarButtonItem字體的iOS 11外觀代理機制無法完全正常工作。 (它的行為在iOS 10中符合預期)。
我想知道這是否是一個錯誤,或者以某種方式可以做到這一點。
我的代碼:
NSDictionary *barButtonAppearanceDict = @{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:24], NSForegroundColorAttributeName: [UIColor purpleColor]};
[[UIBarButtonItem appearance] setTitleTextAttributes:barButtonAppearanceDict forState:UIControlStateNormal];
基本上,代碼似乎可以正常工作,按鈕字體的樣式也適當。 但是,當用戶點擊按鈕時,樣式會在按下按鈕時恢復。
這是一個視頻:
https://www.dropbox.com/s/hqgpbnlq6gw884p/UIBarButtonItem%20Interaction.mov?dl=0
要進行復制,請使用Master-Detail應用程序模板創建一個新應用程序。 在上方添加代碼段:
didFinishLaunchingWithOptions
您忘記設置Highlighted
樣式。
[[UIBarButtonItem appearance] setTitleTextAttributes:barButtonAppearanceDict UIControlStateHighlighted];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.