我有一个我认为非常简单的 Monotouch.Dialog 类。
public partial class EditAccountDialog : DialogViewController
{
Section emailSection;
Section passwordSection;
Section profileSection;
Section addressSection;
EntryElement emailEntry;
EntryElement passwordEntry;
EntryElement password2Entry;
EntryElement firstNameEntry;
EntryElement lastNameEntry;
EntryElement phoneNumberEntry;
EntryElement streetEntry;
EntryElement street2Entry;
EntryElement cityEntry;
EntryElement stateEntry;
EntryElement zipEntry;
public EditAccountDialog(bool pushing) : base (UITableViewStyle.Grouped, null, pushing)
{
emailEntry = new EntryElement(null, "example@domain.com", String.Empty);
passwordEntry = new EntryElement (null, "Password", String.Empty, true);
password2Entry = new EntryElement (null, "Re-enter password", String.Empty, true);
firstNameEntry = new EntryElement ("First Name", "First Name", String.Empty);
lastNameEntry = new EntryElement ("Last Name", "Last Name", String.Empty);
phoneNumberEntry = new EntryElement ("Phone Number", "###-###-####", String.Empty);
streetEntry = new EntryElement ("Street", "#### Any St.", String.Empty);
street2Entry = new EntryElement ("Street 2", "Apt #", String.Empty);
cityEntry = new EntryElement ("City", "City", String.Empty);
stateEntry = new EntryElement ("State", "State", String.Empty);
zipEntry = new EntryElement ("ZIP Code", "#####", String.Empty);
emailSection = new Section ("Email"){
emailEntry,
};
passwordSection = new Section ("Password"){
passwordEntry,
password2Entry,
};
profileSection = new Section("Profile") {
firstNameEntry,
lastNameEntry,
phoneNumberEntry,
};
addressSection = new Section("Address") {
streetEntry,
street2Entry,
cityEntry,
stateEntry,
zipEntry,
};
Root = new RootElement("Edit Account") {
emailSection,
passwordSection,
profileSection,
addressSection,
};
}
public virtual void HandleGetAccountResponse(GetAccountResponse response)
{
emailEntry.Value = response.Email;
firstNameEntry.Value = response.FirstName;
lastNameEntry.Value = response.LastName;
phoneNumberEntry.Value = response.Phone;
streetEntry.Value = response.StreetAdd;
street2Entry.Value = response.StreetAdd2;
cityEntry.Value = response.City;
stateEntry.Value = response.State;
zipEntry.Value = response.Zip;
}
}
页面加载后,我为现有帐户信息异步调用 REST API,然后调用HandleGetAccountResponse
上面的方法来预填充EntryElement
对话框中的每一个。
我检查了 REST 响应并知道我正在接收所有必要的数据。我遇到的问题是此页面上的一两个随机单元格似乎是空白的,即使在设置了它们的值之后也是如此。例如,邮编和城市字段可能显示为空白。
更令人困惑的是,如果我滚动到底部并看到 Zip 和 City 字段为空白,然后一直向上滚动,然后再次滚动到底部,一组不同的单元格可能是空白的,例如作为 Street2 和州。
显然这不是 Monotouch.Dialog 的正常行为,否则没有人会使用它。我能做些什么来解决这个问题?