UIPickerViewModel不缓存视图

时间:2015-11-02 15:24:37

标签: ios xamarin xamarin.ios uipickerview

我有一个带有UIPickerViewModel的UIPickerView。在模型中,我覆盖了GetView方法。

public class PickerViewDelegate : UIPickerViewModel {
...

public override UIView GetView (UIPickerView pickerView, nint row, nint component, UIView view) {

    var tv = (UITextView)view;

    if (view == null) {

        view = new UITextView(frame) {
            Font = ...
        };
        tv = view;
    }

    tv.Text = ...;

    return view;

}

}

问题是视图(GetView方法的第3个参数)始终为null,我必须分配一个新的UITextView。 5件物品都可以,但我有大约200件物品需要很长时间。

你能否给我一个提示 - 我错过了什么,我需要注意什么才能缓解视图?

谢谢。

Andrey Baboshin

0 个答案:

没有答案