0
私は非常に長いスクリーン(多くのフィールド)を持っています。 Xcodeで構造:XamarinとXCode:UIViewとUITableViewのサイズ変更
View
ScrollView
View
View
.
.
.
TableContainer (View)
TableView
TableContainerとテーブルビューは高さを持っています。 私がページに行くとき - 私はの高さを設定しましたテーブルビューアイテムの数に応じて高さは、増加するテーブルビューアイテム数によると。 すべて正常です。 しかし、デバイスを回転させると、TableViewが消えます(高さはにリセットされます)。
クラス:
public partial class TrackingView: BaseView<TrackingViewModel>
{
public TrackingView() : base("TrackingView")
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
var source = new RetrieveShipmentDetailsViewSource(PortsTable, ShipmentDetailsCell.Key, ShipmentDetailsCell.Key);
PortsTable.Source = source;
var set = this.CreateBindingSet<TrackingModel, TrackingViewModel>();
set.Bind(ShipmentLabel).To(vm => vm.ShipmentNumber);
set.Bind(CustCodeLabel).To(vm => vm.Shipment.CustomerCode);
set.Bind(CustNameLabel).To(vm => vm.Shipment.CustomerName);
);
ViewModel.ShipmentLoadedSuccess += (sender, e) =>
{
InvokeOnMainThread(delegate
{
PortsTable.ReloadData();
UpdateView();
});
};
PortsTable.SeparatorStyle = UITableViewCellSeparatorStyle.None;
PortsTable.ReloadData();
set.Apply();
}
private void UpdateView()
{
if (ViewModel.Shipment != null && ViewModel.Shipment.VesselPorts != null)
{
PortsTable.ContentSize = new CGSize(MainView.ContentSize.Width, (ViewModel.Shipment.VesselPorts.Count * 200) + 55);
PortsTable.Frame = new CGRect(PortsTable.Frame.X, PortsTable.Frame.Y, PortsTable.Frame.Size.Width,
(ViewModel.Shipment.VesselPorts.Count * 200) + 55);
MainView.ContentSize = new CGSize(MainView.ContentSize.Width,
MainView.ContentSize.Height + (ViewModel.Shipment.VesselPorts.Count * 200) + 55);
}
}
}
私は、iOSでの新たなんだと私は私の構造が良くないことを知っています。 アドバイス、再読み込み方法TableViewおよびScrollView。 助けてください。 Xcodeで
ありがとうございます@ケビン、それは私のために働く! 他の問題を手伝ってください。 1. https://stackoverflow.com/questions/46224467/mvvmcross-hamburger-menu-for-ios 2. https://stackoverflow.com/questions/46202789/mvvmcross-platform-exceptions-mvxexception-could-not-load-plugin-for-t ありがとうございました。 – DaleYY