我已經使用UINavigationBar drawRect自定義我的UINavigationBar並且它工作正常,直到我啓動了MFMailComposeViewController,這給我帶來了麻煩,因爲我無法爲郵件類重寫UIBarButton,它創建了像如下:MFMailComposeViewController的自定義UINavigationBar問題
雖然我試圖阻止MFMailComposeViewController
和使用默認的drawRect爲MFMailComposeViewController
下面產生的代碼,它更糟糕的是創建一個黑色UIBar
:
驗證碼:
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
//Prevent Mail Controller For Customizing NavigationBar
for (UIView* next = [self superview]; next; next = next.superview) {
UIResponder* nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[MFMailComposeViewController class]]) {
[super drawRect:rect];
return;
}
}
UIImage *image = [UIImage imageNamed: @"titleBar.png"];
[image drawInRect:CGRectMake(0, 0, 320, 44)];
}
@end
我想在這裏做的就是確保MFMailComposeViewController
具有UINavigationBar
和UIButtonItem
相同的風格。它可以是任何一種方式:
1)兩個UINavigationBar
和UIButtonItem
已自定義背景
2)默認UINavigationBar
風格(藍色漸變)
想知道我能做到這一點?提前致謝。
保存和取消按鈕是否啓用?在我的應用程序中,我還有一個自定義導航欄,當我嘗試使用MFMailComposeViewController撰寫郵件時,MFMailComposeViewController的導航欄被自定義導航欄覆蓋。所以取消和保存按鈕被禁用。如何使它們啓用?劑量任何人有任何想法? – Dee 2011-08-02 05:55:34
我使用UINavigationBar的子類,當顯示郵件撰寫時,導航欄按鈕也被禁用。有沒有人有解決方案? – youshunei 2012-01-13 17:59:48