簡體   English   中英

MVVMCross綁定屬性在iOS模擬器中工作正常,但在設備上失敗

[英]MVVMCross binding property works fine in iOS simulator but fails on device

我觀察到非常奇怪的行為。 我已經將位於自定義單元格視圖內的UIProgressView綁定到我的視圖模型的float屬性。 這里要明確的是我在核心層的視圖模型:

public class DownloadCellViewModel: MvxViewModel
{
    float _Progress;
    public float Progress {
        get{
            return _Progress;
        }
        set{
            _Progress = value;
            this.RaisePropertyChanged (() => this.Progress);
        }
    }
}

這是UI前端層中的單元格視圖綁定代碼:

public DownloadCell (IntPtr handle) : base (handle)
    {   
        this.DelayBind(() => {
            var set = this.CreateBindingSet<DownloadCell, DownloadCellViewModel> ();

            set.Bind(ProgressDownload).For(p=>p.Progress).To(item=> item.Progress);

        set.Apply();
        });
    }

請注意,ProgressDownload是一個UIProgressView,我將其放在xib文件中。 現在的問題是,當我運行此代碼時,它可以在模擬器中按預期工作,但在設備上卻出現以下錯誤:

MvxBind:Warning:104,99 Failed to create target binding for binding Progress for Progress

有任何想法嗎?

我相信鏈接器優化導致了問題將以下內容添加到LinkerPleaseInclude.cs文件中

public class LinkerIncludePlease
{
        public void Include(MvxTableViewCell vc)
        {
            vc.BackgroundColor = UIColor.Blue;
        }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM