MonoTouch Dialog自定义字体

时间:2011-10-21 14:00:59

标签: c# iphone ios xamarin.ios monotouch.dialog

我对MonoTouch很新,注意到MonoTouch Dialog api非常有用。我想要实现的是这样的:

enter image description here http://img641.imageshack.us/img641/8514/consumentstartscherm.png

所以我想在表格视图中使用常规文本..但我怎样才能实现这一目标?目前我将文本放在标题部分,但这是一个粗体字。

1 个答案:

答案 0 :(得分:3)

这样的事情会让你接近:

        var label = new UILabel ();
        var frame = label.Frame;
        frame.Inflate (0, 32);
        label.Frame = frame;
        label.Font = UIFont.BoldSystemFontOfSize (32);
        label.Text = "Ad4You";
        label.TextAlignment = UITextAlignment.Center;
        label.BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f);

        Section s = new Section ("Ad4You");
        s.HeaderView = label;

        s.Add (new StyledMultilineElement (String.Empty, 
            "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
            UITableViewCellStyle.Subtitle));

        var root = new RootElement ("Home");
        root.Add (s);

        var dv = new DialogViewController (root, true) { Autorotate = true };
        NavigationController.PushViewController (dv, true);             

享受MonoTouch和MonoTouch.Dialog的乐趣: - )