MFMessageComposeViewController的收件人字段未在iOS 7中显示 [英] Recipients field of MFMessageComposeViewController doesn't show in iOS 7

查看:121
本文介绍了MFMessageComposeViewController的收件人字段未在iOS 7中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码在iOS 5/6中运行良好。在iOS 7中,它看起来像这样(红色椭圆形用于强调)。

The code below works fine in iOS 5/6. In iOS 7, it looks like this (red oval for emphasis).

代码:

if ([MFMessageComposeViewController canSendText]) {
    self.messageComposer = [MFMessageComposeViewController new];
    self.messageComposer.recipients = @[number];
    self.messageComposer.messageComposeDelegate = self;
    [self presentViewController:self.messageComposer
                       animated:YES
                     completion:nil];
}

问题:这是简单的代码。是否有其他外部属性,可能是呈现视图控制器,正在影响这个?任何人都有修复或解决方法?

Question: This is simple code. Is there some other external property, perhaps of the presenting view controller, that is affecting this? Anyone have a fix or workaround?

谢谢。

推荐答案

我我们发现MFMessageComposeViewController的收件人字段似乎从iOS7中的UINavigationBar外观代理中获取了一些外观。为了解决这个问题,我在我的应用程序中完成了以下操作:

I've found that the MFMessageComposeViewController's recipient field seems to take some of it's appearance from the UINavigationBar appearance proxy in iOS7. To work around this, I've done the following in my apps:


  1. 创建一个空的自定义UINavigationController子类,它不会覆盖任何UINavigationController的方法。

  2. 通过在IB中的身份检查器上设置自定义类,将此自定义UINavigationController子类用作我想要具有自定义外观的任何导航控制器的标记:

  1. Create an empty custom UINavigationController subclass, which doesn't override any of UINavigationController's methods.
  2. Use this custom UINavigationController subclass as a marker for any navigation controllers that I want to have custom appearance, by setting the custom class on the identity inspector in IB:

在我的app delegate中,设置如下导航栏的外观:

In my app delegate, set up the appearance of navigation bars like this:

[[UINavigationBar appearanceWhenContainedIn:[MyCustomNavigationController class], nil] ...];


这可确保我获得导航栏外观我想在我想要自定义的控制器中,但保留其他控制器(如MFMessageComposeViewController)中的标准导航栏(和相关)外观。这是截图;注意MFMessageComposeViewController的标准外观,后台弹出窗口上的自定义导航栏外观:

This ensures that I get the navigation bar appearance I want in the controllers I want to customize, but preserves the standard navigation bar (and related) appearance in other controllers (like MFMessageComposeViewController). Here's a screenshot; note the standard appearance of MFMessageComposeViewController, with the custom navigation bar appearance on the popover in the background:

这篇关于MFMessageComposeViewController的收件人字段未在iOS 7中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆