0
考慮下面的代碼:如何定位的UITableView(MonoTouch的)
public class MainTableController : UITableViewController
{
// Allow us to set the style of the TableView
public MainTableController(UITableViewStyle style) : base(style)
{
}
public override void ViewDidLoad()
{
TableView.DataSource = new MainTableDataSource();
TableView.Delegate = new MainTableDelegate(this);
TableView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile ("Content/[email protected]"));
TableView.Bounces = false;
base.ViewDidLoad();
}
}
鑑於以下的輸出:
我如何更新我的代碼,以便組表格單元格開始的在頁面的一半?實際的像素並不重要,我只是想弄清楚屬性要修改的地方。
手動定位有什麼危害?我是新手,如果您能提出更好的解決方案來滿足我的需求,請讓我知道,因爲我想遵守最佳做法。感謝你的回答。 –
通常,UIViewController的視圖(UITableViewController只是從UIViewController繼承而來)* always *想要全屏,除非它在iOS 5.x中使用自定義容器API。底線:他們已經證明,如果手動定位,你會得到不可靠的行爲,並且他們已經規定了更好的方法。上面的代碼應該會給你想要的效果。 – Anuj
謝謝。這可能是一個不同的問題,但如果你注意到我上面的代碼,我有一個使用的背景圖像。當我實施您的解決方案時,它也將向下推送背景圖像。這個問題最初的原因是因爲實際上UITableView背後有一個需要可見的標識。你的解決方案將UITableView向下推,但也與圖像一樣。 –