颜色 – iOS 10无法再在MFMessageComposeViewController上设置barcolor和tint

颜色 – iOS 10无法再在MFMessageComposeViewController上设置barcolor和tint,第1张

概述以下代码适用于iOS 9.x或更低版本,由于某些原因,如果iOS 10不起作用 if([MFMessageComposeViewController canSendText]) { controller.body = message; NSString *tel = pContact.tlc; 以下代码适用于iOS 9.x或更低版本,由于某些原因,如果iOS 10不起作用
if([MFMessageComposeVIEwController canSendText])             {                 controller.body = message;                 Nsstring *tel = pContact.tlc;                 controller.recipIEnts = pContact.tlc?@[tel]:nil;                 controller.messageComposeDelegate = self;                 controller.navigationbar.tintcolor = [UIcolor whitecolor];                 controller.navigationbar.barTintcolor = [UIcolor bluecolor];                 [self presentVIEwController:controller animated:YES completion:nil];             }

是破坏还是做了一些改变.不知道这里丢失什么我在黑暗中(黑色黑色)

编辑:
我试图在一个新的空单视图项目上使用一些测试代码,我遇到了同样的问题.

@IBAction func SMS(_ sender: AnyObject) {        let composeVC = MFMessageComposeVIEwController()        composeVC.messageComposeDelegate = self        // Configure the fIElds of the interface.        composeVC.recipIEnts = ["5555555555"]        composeVC.body = "Hello from California!"        composeVC.navigationbar.tintcolor = UIcolor.green        composeVC.navigationbar.barTintcolor = UIcolor.purple        // Present the vIEw controller modally.        self.present(composeVC,animated: true,completion: nil)    }

编辑:
UINavigationbar外观可以在测试应用程序的背景或barTint中设置颜色,但是我仍然无法设置测试应用程序的文本颜色.我正在使用的应用程序使用UINavigationbar外观已经在应用程序中设置导航栏颜色,但这并不影响SMS的导航栏,因为它出现了白色背景和白色文本.无法更改文本颜色或背景颜色,使此视图不可用.

解决方法 在iOS 10之前,我正在使用UINavigationbar的外观代理,像这样:
NSDictionary* TitleAttribs = @{ NSForegroundcolorAttributename: [ColoursAndStyles sharedInstance].FontColourNavbarTitle,NSFontAttributename: [ColoursAndStyles sharedInstance].FontNavbarBoldTitle };[[UINavigationbar appearance] setbarTintcolor:[ColoursAndStyles sharedInstance].vIEwColourNavbarMain];[[UINavigationbar appearance] setTintcolor:[ColoursAndStyles sharedInstance].vIEwColourNavbarTint];[[UINavigationbar appearance] setTitleTextAttributes:TitleAttribs];

这覆盖了我对MFMessageComposeVIEwController的使用,其中setTitleTextAttributes处理标题/标题的文本颜色.

使用iOS 10,我正在使用以下工作.在我提交MFMessageComposeVIEwController之前,我更改标题文本属性.例如.:

- (voID)sendTap:(ID)s{    // some code...    NSDictionary* newTitleAttribs = @{ NSForegroundcolorAttributename: [ColoursAndStyles sharedInstance].FontColourTitleStrip,NSFontAttributename: [ColoursAndStyles sharedInstance].FontNavbarBoldTitle };    [[UINavigationbar appearance] setTitleTextAttributes:newTitleAttribs];    // present the MFMessageComposeVIEwController...}

然后,当MFMessageComposeVIEwController完成时,将其重新设置为我想要的应用程序的其余部分,例如:

- (voID)messageComposeVIEwController:(MFMessageComposeVIEwController *)controller dIDFinishWithResult:(MessageComposeResult)result{    NSDictionary* TitleAttribs = @{ NSForegroundcolorAttributename: [ColoursAndStyles sharedInstance].FontColourNavbarTitle,NSFontAttributename: [ColoursAndStyles sharedInstance].FontNavbarBoldTitle };    [[UINavigationbar appearance] setTitleTextAttributes:TitleAttribs];    // some code...    [controller dismissVIEwControllerAnimated:YES completion:^{        // some code...    }];}
总结

以上是内存溢出为你收集整理的颜色 – iOS 10无法再在MFMessageComposeViewController上设置barcolor和tint全部内容,希望文章能够帮你解决颜色 – iOS 10无法再在MFMessageComposeViewController上设置barcolor和tint所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1111392.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存