如何使用UIAppearance在UINavigationBar上设置提交按钮的样式?
问题描述:
我正在用UIApperance设计我的iOS应用程序。我已经设法使所有UINavigationBar中的所有酒吧按钮项都具有灰色文本,只有一个特定的按钮 - MFMessageComposeViewController视图的发送按钮保持其默认白色。为什么我的代码会针对除此之外的每个按钮?如何使用UIAppearance在UINavigationBar上设置提交按钮的样式?
NSDictionary* normalStyle = [NSDictionary
dictionaryWithObjects:[NSArray
arrayWithObjects:
[UIColor navigationTextNormalColor],
[UIColor whiteColor],
[NSValue
valueWithUIOffset:UIOffsetMake(
0,
1
)
]
, nil
]
forKeys:[NSArray
arrayWithObjects:
UITextAttributeTextColor,
UITextAttributeTextShadowColor,
UITextAttributeTextShadowOffset,
nil
]
];
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationController class], nil]
setTitleTextAttributes:normalStyle
forState:UIControlStateNormal
];
[[UINavigationBar appearanceWhenContainedIn:[UINavigationController class], nil]
setTintColor:[UIColor navigationBarTintColor]
];
答
根据文档:
重要的邮件撰写界面本身并不定制 而不能使用你的应用程序进行修改。此外,在 呈现界面之后,您的应用程序不允许对电子邮件内容进行进一步更改 。用户仍然可以使用界面编辑内容,但程序化更改将被忽略。 因此,您必须在呈现 接口之前设置内容字段的值。
我不认为UINavigationBar是邮件编辑器视图的一部分,因为它位于层次结构之外。 – JoJo
我花了很多时间试图解决这个问题。你可以自定义颜色/背景,但这是关于它。基本上他们不希望任何人能够诱骗某人发送电子邮件。 –