0
我正在使用C#
和Xamarin制作基本的笔记记录应用程序。 我遇到的问题是在我的AddNoteViewController
中,布局的顺序错误。 正确的布局应该是:Xamarin Studio iOS应用程序中的屏幕布局不正常
1. Title entry box
2. Description label for text input
3. Text input field
然而,描述标签是莫名其妙地在顶部,标题输入框的上方,尽管我在代码中指定的布局。
AddNoteViewController_.cs
using System;
using UIKit;
namespace NoteTaker.iOS
{
public class AddNoteViewController : UIViewController
{
public AddNoteViewController()
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB (255, 0, 255);
this.Title = "New Note";
this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.White };
this.NavigationController.NavigationBar.TintColor = UIColor.White;
this.View.BackgroundColor = UIColor.White;
var titleEntryBox = new UITextField() {
Frame = new CoreGraphics.CGRect (10, 100, 250, 100),
BackgroundColor = UIColor.Clear,
Placeholder = "Enter title...",
TextColor = UIColor.Black
};
var descriptionLabel = new UILabel() {
Frame = new CoreGraphics.CGRect (10, 100, 250, 35),
Text = "Enter description below"
};
var descriptionEntryBox = new UITextView() {
Frame = new CoreGraphics.CGRect (10, 220, 250, 100),
BackgroundColor = UIColor.Clear,
TextColor = UIColor.Black
};
this.View.Add (titleEntryBox);
this.View.Add (descriptionLabel);
this.View.Add (descriptionEntryBox);
}
}
}