【发布时间】:2012-12-04 15:53:10
【问题描述】:
我有一个我认为非常简单的 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 字段为空白,然后一直向上滚动,然后再次滚动到底部,不同 strong> 一组单元格可能是空白的,例如 Street2 和 State。
显然这对于 Monotouch.Dialog 来说是不正常的行为,否则没人会使用它。我可以做些什么来解决这个问题?
【问题讨论】:
-
只有单元格值是空的,还是标签也是空的?您最好的选择可能是使用 MT.D 源代码(来自 github)并对其进行调试。或者,如果您可以提出一个孤立的测试用例,请向 Xamarin 提交错误。
-
这些值不是空的,它们只是在屏幕上不可见。我应该在问题标题中澄清一下。
-
这听起来像是 MT.D 中可能存在的错误 - 如果您可以创建一个独立的测试用例,我会将其提交给 Xamarin
-
我想出了一个并昨天提交给他们,但还没有收到回复。
-
这通常发生在您有不同类型的单元格重用相同的 reusableIdentifierKey 时,但似乎您的所有元素都是 EntryElements,所以这应该不是问题。
标签: c# ios xamarin.ios monotouch.dialog