我在我的应用程序中使用 mfmessagecomposeviewcontroller 发送短信。我的问题是,当视图出现时,导航标题和按钮的标题字体与应用程序字体不同。我想改变这个标题的字体。我有很多尝试设置它,但我做不到。请给我一些例子或想法,我该怎么做。
我的代码如下
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];
}
提前致谢。