0

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.

Bilal hussain
  • 105
  • 1
  • 3
  • 9

1 Answers1

1

Use this:

messageController.topViewController.navigationItem.titleView = yourLabelHereWithANyFont;

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

Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132
  • Thanks for reply Prince, but cannot we change it with controller.navigationbar.titletextAttribute=dictionary; – Bilal hussain Mar 20 '13 at 06:13
  • sorry borther now this issue occuring first app crashed with this message 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target – Bilal hussain Mar 20 '13 at 06:22
  • Thank you I tried everything to hide the title text and this is the only thing that did it. – abc123 Dec 01 '13 at 22:37