У меня есть то, что я считаю довольно простым классом 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, "[email protected]", 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 и знаю, что получаю все необходимые данные. Проблема, с которой я сталкиваюсь, заключается в том, что одна или две случайные ячейки на этой странице кажутся пустыми, даже после того, как их значения были установлены. Например, поля «Почтовый индекс» и «Город» могут оказаться пустыми.
Что еще больше сбивает с толку, так это то, что если я прокручиваю вниз и вижу, что поля Почтовый индекс и Город пусты, затем прокручиваю до конца вверх, затем снова прокручиваю вниз, другой набор ячеек могут быть пустыми, например Street2 и State.
Очевидно, что это ненормальное поведение для Monotouch.Dialog, иначе никто бы его не использовал. Что я могу сделать, чтобы решить эту проблему?