Change title of MFMailComposeViewController

前端 未结 6 1361
广开言路
广开言路 2020-12-15 08:17

I\'m using MFMailComposeViewController for in-app email in my app, but I\'m not able to change the title. As default it\'s showing the subject in the title, but I would like

6条回答
  •  情深已故
    2020-12-15 08:34

    Sbrocket's answer works great. This is how to add a title view (label):

    // existing
    [self presentModalViewController:controller animated:YES];
    
    // new code
    CGRect frame = CGRectMake(0, 0, 320, 44);
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont fontWithName:@"MarkerFelt-Thin" size:18.0];
    label.adjustsFontSizeToFitWidth = YES;
    label.minimumFontSize = 12.0;
    label.textAlignment = UITextAlignmentCenter;
    label.textColor = [UIColor darkGrayColor];
    label.text = @"Your Comments";
    [[[[controller viewControllers] lastObject] navigationItem] setTitleView:label];
    

    Same comments as above, it's not really recommended to customize MFMailComposeViewController...

提交回复
热议问题