簡體   English   中英

MFMessageComposeViewController:無法在暗模式下設置“取消”按鈕的樣式

[英]MFMessageComposeViewController: Cannot Style "Cancel" Button in Dark Mode

我目前正在嘗試設計右上角的“取消”按鈕(導航欄和按鈕都是灰色的),但我沒有運氣。 我試過調用幾種不同的方法,但都沒有奏效。 我的項目為 iOS12.1 構建,我正在通過 iOS15.4 進行測試。 這是我迄今為止嘗試過的:

[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                          [UIFont fontWithName:@"Futura-Medium" size:17.0f],
                                                          NSFontAttributeName,
                                                          [UIColor blueColor],
                                                          NSForegroundColorAttributeName,
                                                          nil]];
MFMessageComposeViewController *messageController;
[messageController.navigationBar setTintColor:[UIColor blueColor]];
messageController = [MFMessageComposeViewController new];
[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:[NSArray arrayWithObject:[UINavigationBar class]]].tintColor = [UIColor RepublicBrightBlue];

按鈕的灰色可能來自您的應用程序的全局色調。 默認情況下,這是資產中的 AccentColor(通過構建設置映射)。 請注意,您可以為Any, Light, Dark定義單獨的全局強調色在此處輸入圖像描述

如果您只是對這個 MFMessageComposeViewController 的樣式感興趣,那么以下對我來說可以更改消息視圖中所有視圖的色調顏色:

MFMessageComposeViewController *messageController = [MFMessageComposeViewController new];
[self presentViewController:messageController animated:true completion:nil];
[UIView appearanceWhenContainedInInstancesOfClasses:[NSArray arrayWithObject:[MFMessageComposeViewController class]]].tintColor = [UIColor redColor];

這導致在此處輸入圖像描述

暫無
暫無

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

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