Ios 禁用MFMessageComposeViewController的自定义外观
当用户向MFMessageComposeViewController的收件人部分输入名称时,收件人栏变为黑色并消失。用户仍然可以发送消息、输入文本和执行所有其他操作,他们只是看不到收件人栏 我觉得这可能是(也可能不是)因为MFMessageComposeViewController的导航栏是定制的(背景图像和自定义字体) 1。我的导航栏的自定义外观是为整个应用程序设置的,如何为MFMessageComposeViewController禁用它?Ios 禁用MFMessageComposeViewController的自定义外观,ios,objective-c,cocoa-touch,ios7,Ios,Objective C,Cocoa Touch,Ios7,当用户向MFMessageComposeViewController的收件人部分输入名称时,收件人栏变为黑色并消失。用户仍然可以发送消息、输入文本和执行所有其他操作,他们只是看不到收件人栏 我觉得这可能是(也可能不是)因为MFMessageComposeViewController的导航栏是定制的(背景图像和自定义字体) 1。我的导航栏的自定义外观是为整个应用程序设置的,如何为MFMessageComposeViewController禁用它? 2。这个小故障还有其他原因吗?这是一个iOS7错误
2。这个小故障还有其他原因吗?这是一个iOS7错误吗?是的,这里的问题是因为我使用UIAvigationBars的UIAppearance代理 那么是什么解决了这个问题呢 我没有尝试更改MFMessageComposeViewController,它本身更像是一个应用程序,而是定制了自己的应用程序 我没有使用
[UINavigationBar外观]
,而是使用了[UINavigationBar外观(当包含在:[SomeNavigationController类]中时),nil]
如果你能做到这一点,我认为这真的很简单,因为试图定制MFMessageComposeViewController可能会很烦人
以上所有内容都适用于MFmailcomposivewcontroller。因此,是的,这里的问题是因为我使用UIAvigationBars的UIAppearance代理 那么是什么解决了这个问题呢 我没有尝试更改MFMessageComposeViewController,它本身更像是一个应用程序,而是定制了自己的应用程序 我没有使用
[UINavigationBar外观]
,而是使用了[UINavigationBar外观(当包含在:[SomeNavigationController类]中时),nil]
如果你能做到这一点,我认为这真的很简单,因为试图定制MFMessageComposeViewController可能会很烦人
以上所有内容都适用于MFMailComposeViewController。我遇到了同样的问题,下面是我的解决方案- 在演示您的消息生成器之前(
[self-presentViewController:messageComposer动画:是完成:无];
)
设置
[[UINavigationBar外观]setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]代码>
和在委托方法中
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller
didFinishWithResult:(MessageComposeResult)result {
UIImage *backgroundImage = [UIImage imageNamed:@"Navigation Bar"];
[[UINavigationBar appearance] setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
[self dismissViewControllerAnimated:YES completion:nil];
}
就这些 我也面临同样的问题,下面是我的解决方案-
在演示您的消息生成器之前([self-presentViewController:messageComposer动画:是完成:无];
)
设置
[[UINavigationBar外观]setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]代码>
和在委托方法中
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller
didFinishWithResult:(MessageComposeResult)result {
UIImage *backgroundImage = [UIImage imageNamed:@"Navigation Bar"];
[[UINavigationBar appearance] setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
[self dismissViewControllerAnimated:YES completion:nil];
}
就这些 我无法更改文本颜色,我尝试过这样做:[[UINavigationBar Appearancewhen contained in:[MFMailComposeViewController类],nil]SetPartInColor:[UIColor whiteColor];[[UIBarButtonItem外观,当包含在:[MFMailComposeViewController类]中时,无]设置颜色:[UIColor whiteColor]];[[UIBarButtonItem Appearancewhen contained in:[MFMailComposeViewController类],nil]setTitleTextAttributes:[NSDictionary Dictionary Dictionary With Objects and Keys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]用于状态:UIControlStateNormal];我认为iOS不允许您直接使用外观更改MFMailComposeViewController的颜色(因为它是基于系统的视图控制器)。如果无法更改文本颜色,我尝试过这样做:[[UINavigationBar AppearanceWhen contained in:[MFMailComposeViewController类],nil]SetPartInColor:[UIColor whiteColor]]; [[UIBarButtonItem外观,当包含在:[MFMailComposeViewController类]中时,无]设置颜色:[UIColor whiteColor]];[[UIBarButtonItem Appearancewhen contained in:[MFMailComposeViewController类],nil]setTitleTextAttributes:[NSDictionary Dictionary Dictionary With Objects and Keys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]用于状态:UIControlStateNormal];我认为iOS不允许您直接使用包含在中的外观更改MFMailComposeViewController的颜色(因为它是基于系统的视图控制器)