MFMessageComposeViewController does not respect appearance overrides

RLittlesIIRLittlesII USMember ✭✭

Does anyone know how to override the style for a MFMessageComposeViewController?

It doesn't appear to respect the Appearance API changes. It does take the global style for a UINavigationBar but my Nav bar text is white and the "Cancel" button doesn't show well. So I want to override the appearance, specifically for that type.

UINavigationBar.AppearanceWhenContainedIn(typeof(MFMessageComposeViewController)).TitleTextAttributes = new UIStringAttributes{ ForegroundColor = UIColor.Green };
UIBarItem.AppearanceWhenContainedIn(typeof(MFMessageComposeViewController)).SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.Green}, UIControlState.Normal);
UIBarButtonItem.AppearanceWhenContainedIn(typeof(MFMessageComposeViewController)).SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.Green }, UIControlState.Normal);

I attempted a custom renderer, and abandoned the global style, but I was unable to exclude just the MFMessageComposeViewController. Is there any way in the below renderer that I can get access to the control I am overriding to check if it is a MFMessageComposeViewController?

[assembly: ExportRenderer(typeof(NavigationPage), typeof(NavigationBarRenderer))]
namespace Reunification.iOS
{
    public class NavigationBarRenderer : NavigationRenderer
    {
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.NavigationBar.TintColor = ExportedColors.InverseTextColor.ToUIColor();
            this.NavigationBar.BarTintColor = ExportedColors.AccentColor.ToUIColor();
            this.NavigationBar.BarStyle = UIBarStyle.Black;
        }
    }
}

Posts

  • RLittlesIIRLittlesII USMember ✭✭

    I solved this with the custom renderer and removing all global styles. It doesn't seem to have any side effects other than I am unable to use iOS Appearance API's in my application for UINavigationBar.

Sign In or Register to comment.