can we change MFmessagecomposeViewcontroller navigtion title font

你。 提交于 2019-12-25 04:58:34

问题


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.

My code is below

 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];

}

thanks in advance.


回答1:


Use this:

messageController.topViewController.navigationItem.titleView = yourLabelHereWithANyFont;

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



来源:https://stackoverflow.com/questions/15516303/can-we-change-mfmessagecomposeviewcontroller-navigtion-title-font

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!