簡體   English   中英

使用UIAppearance代理自定義字體時,MFMailComposeViewController不起作用

[英]MFMailComposeViewController does not work when customizing font with UIAppearance proxy

當我不在我的應用程序中自定義字體時,MFMailComposeViewController被呈現並正常工作。 但是當我這樣做的時候,有50%的時間它被呈現並直接用mailComposeController:didFinishWithResult:調用他的委托mailComposeController:didFinishWithResult:結果MFMailComposeResultCancelled就像用戶只是試圖關閉它一樣。

並在控制台中觸發此錯誤:

_serviceViewControllerReady:error: Error Domain=XPCObjectsErrorDomain Code=2 "The operation couldn’t be completed. (XPCObjectsErrorDomain error 2.)"

看起來郵件編輯器不喜歡外觀代理,但問題是它不是事件可能會禁用它的外觀代理。

對於我的應用程序中的每個導航欄,我都有自定義設計。 為了實現這一點,我使用了appearence代理,如下所示:

UIImage *navBarBackground = [UIImage stretchableHorizontalImageNamed:@"navbar-background"];
[[UINavigationBar appearance] setBackgroundImage:navBarBackground forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage imageNamed:@"navbar-shadow"]];
[[UINavigationBar appearance] setTitleTextAttributes:@{
    UITextAttributeTextColor: [UIColor colorWithRed:0.965f green:0.635f blue:0.647f alpha:1.f],
    UITextAttributeFont : [UIFont brothersBoldFontOfSize:20.f],
    UITextAttributeTextShadowColor: [UIColor blackColor],
    UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, -1)]
}];

UIBarButtonItem *navBarButtonItemAppearance = [UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil];
[navBarButtonItemAppearance setTitleTextAttributes:@{
    UITextAttributeTextColor: [UIColor colorWithRed:0.478f green:0.008f blue:0.023f alpha:1.f],
    UITextAttributeFont : [UIFont brothersBoldFontOfSize:17.f],
    UITextAttributeTextShadowColor: [UIColor colorWithWhite:1.f alpha:0.3f],
    UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 1)]
} forState:UIControlStateNormal];

我刪除了popover的一些后台自定義:

[[UINavigationBar appearanceWhenContainedIn:[UIPopoverController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

它適用於popover。 但是不可能為郵件編寫器刪除它,即使我使用“當包含在”MFMailComposeViewController並將其設置為nil它仍然在這里。

我也嘗試將其子類化或設置系統字體,但這不會改變任何東西。 他出現了,打印錯誤,打電話給他的代表並被解雇。 我剛剛看到它在工作時,系統沒有應用該字體,當它沒有被提供下面的自定義字體時。

在此輸入圖像描述

問題是自定義字體加載時間太長,它會觸發等待時間超時。

請參閱: MFMailComposeViewController拋出viewServiceDidTerminateWithError,然后在使用自定義標題字體時退出

暫無
暫無

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

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