以更改MFmessagecomposeViewcontrolle

以更改MFmessagecomposeViewcontrolle

本文介绍了我们可以更改MFmessagecomposeViewcontroller导航标题字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用mfmessagecomposeviewcontroller发送短信。我的问题是,当视图出现时,导航标题和按钮的标题字体与应用字体不同。我想改变这个标题的字体。我有很多尝试设置它,但我不能这样做..请给我一些例子或想法,我怎么能这样做。

I am using mfmessagecomposeviewcontroller in my app for sending sms. My problem is that when view present then the navigation title and button's title font not same to the appliction font. I want to change the font of this title. I have so much try to set it but i can not do it.. Please give me some example or idea about it that how can i do it.

我的代码低于

 if([MFMessageComposeViewController canSendText])
        {
            MFMessageComposeViewController *messageController=[[MFMessageComposeViewController alloc] init];
            messageController.messageComposeDelegate=self;
            messageController.topViewController.navigationController.navigationBar.titleTextAttributes=[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Tijjxdydjmmdouybfrertnsaenp" size:21],UITextAttributeFont, nil];
            [messageController.topViewController.navigationItem.rightBarButtonItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Tijjxdydjmmdouybfrertnsaenp" size:21],UITextAttributeFont, nil] forState:UIControlStateNormal];
            messageController.body=@"Hey, you should get this app, it allows us to create and share recipes with each other, & it also has a 7 day meal plan with grocery list. https://itunes.apple.com/us/app/fit-chick-meal-plan-recipe/id576329137?ls=1&mt=8 ";
            messageController.title=@"SMS";
            [messageController setModalTransitionStyle:UIModalPresentationPageSheet];
            [self presentViewController:messageController animated:YES completion:^(void){}];
        }

-(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
    switch (result) {
        case MessageComposeResultSent:
        {
            [AppUtility displayAlertForTitle:@"Message Status" forMessage:@"Message has been sent successfully" forDelegate:nil forCancelButton:@"Ok"];
        }
            break;
        case MessageComposeResultCancelled:
        {
            NSLog(@"Message sending cancelled");
        }
            break;
        case MessageComposeResultFailed:
        {
            [AppUtility displayAlertForTitle:@"Message Status" forMessage:@"Message sending failed" forDelegate:nil forCancelButton:@"Ok"];
        }
            break;
        default:
        {
            [AppUtility displayAlertForTitle:@"Message Status" forMessage:@"Message sending failed" forDelegate:nil forCancelButton:@"Ok"];
        }
            break;
    }
    [self dismissViewControllerAnimated:YES completion:nil];

}

提前感谢。

推荐答案

使用此:

messageController.topViewController.navigationItem.titleView = yourLabelHereWithANyFont;

创建 UILabel 并更改其中的字体并提供给 titleView

Create a UILabeland change font in it and provide to titleView.

这篇关于我们可以更改MFmessagecomposeViewcontroller导航标题字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 09:20