2013-03-08 84 views
3

當我未自定義我的應用程序中的字體時,MFMailComposeViewController顯示並工作正常。但是當我這樣做的時候,有50%的時間出現,並直接打電話給他的代表mailComposeController:didFinishWithResult:,結果MFMailComposeResultCancelled就好像用戶試圖關閉它一樣。當使用UIAppearance代理自定義字體時,MFMailComposeViewController不起作用

而且還會引發這個錯誤在控制檯:

_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]; 

我刪除了與如下因素的酥料餅的一些背景定製:

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

它的正常工作爲酥料餅。但是,即使當我使用「當包含在」MFMailComposeViewController並將其設置爲nil時,它仍然存在,但不可能爲郵件編輯器刪除它。

我也嘗試子類化或設置系統字體,但不會改變任何東西。他得到了介紹,打印錯誤,打電話給他的代表並被解僱。我剛剛看到,當它工作時,字體不會被系統應用,並且當它沒有被呈現如下的自定義字體時。

enter image description here

+0

嘿,你有解決方案嗎?因爲我面臨同樣的問題,並且在幾天之後也一起搜索。如果你已經成功解決了這個問題,請讓我知道...... :) – Krunal 2013-03-30 06:48:54

+0

還沒有解決方案。 – 2013-03-30 20:50:39

+1

我已經得到了解決方案....如果你已經在你的任何類中用'UINavigationBar'設置了自定義字體,那麼它會影響'MFMailComposeViewController'。所以,你從所有的類中刪除自定義的導航欄字體,它會正常工作。我認爲這是唯一的解決方案。你可能已經設置導航欄自定義字體... :) – Krunal 2013-04-01 05:55:24

回答

相關問題