Monotouch.Dialog : 部分字体 [英] Monotouch.Dialog : Section font
问题描述
是否可以访问节页眉和页脚的字体和颜色属性,或者我是否需要子类化节?我将 UI 更改为全黑,除了部分页眉和页脚外,一切看起来都很棒.
It it possible to access the font and color properties of the section header and footer or do I need to subclass Section? I changed my UI to all black and everything looks great except my section headers and footers.
反射 API:
class Login
{
public string Version = "1.2.3";
[Section ("Enter your credentials", "Email and password are required")]
[Entry ("Enter your email address")]
public string email;
[Caption ("Password"), Password ("Enter your password")]
public string password;
[OnTap ("Login")]
[Alignment (UITextAlignment.Center)]
public string Logon;
}
元素 API:
return new RootElement ("Login") {
new Section() {
new StringElement ("Version", "1.2.3")
},
new Section ("Enter your credentials", "Email and password are required") {
new EntryElement("Email", "Enter your email address", "azcoov"),
new EntryElement("Password", "Enter your password", "password", true),
new StringElement("Logon", Login)
}
}
推荐答案
部分页眉和页脚可以指定为字符串或 UIViews,遗憾的是,两者之间没有任何内容.
Section headers and footers can either be specified as strings or UIViews, there is sadly, nothing in between.
如果您想拥有自定义标题/视图,则需要创建一个 UILabel 并在构造函数中将其用于 Section 类型(仅适用于 Elements API).
If you want to have custom headers/views, you would need to create a UILabel and use that in your constructor to the Section type (only available for the Elements API).
类似于:
var header = new UILabel (new RectangleF (0, 0, 320, 48)){
Font = UIFont.BoldSystemFontOfSize (22),
BackgroundColor = UIColor.Red
}
new Section(header, footer) {
...
}
这篇关于Monotouch.Dialog : 部分字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!