migueldeicaza / MonoTouch.Dialog

Tools to simplify creating dialogs with the user using MonoTouch
MIT License
430 stars 211 forks source link

EntryElement caching bug #175

Closed beeradmoore closed 11 years ago

beeradmoore commented 11 years ago

Made a sample app to show what the issue is.

https://dl.dropbox.com/u/11374958/EntryElementBug.zip

Gives you an entry element with "Test1" as the caption on the left. Bottom of the screen is 3 buttons in a toolbar.

Press the "1" and it removes the first section. Then press the "2" and it adds a new section and it creates 15 (enough to cover more than the screen) EntryElement's. This time instead of having "Test1" it passes through null. Passing through "" also has the same effect. Press "3" will then add another new section, with 15 more EntryElement's. These ones through have "Test2" as the caption text on the left and they have text of "placeholder" in the placeholder. When you scroll to them some will show place holder and others will not. The ones without "placeholder" will act weird when you go to edit them. Your cursor, or any text you write wont be visible. They are behind something... They eventually will show on the far right. You can also highlight them to see that that the text is there.

If you remove the dequing of the cells in the GetCell function (and thus removing any caching improvements it has) it will work fine.

Issue happens with MT 6.0.10 and the MT.D bundled with it. Though I have pulled the source and recompiled against it and issue still persists.

migueldeicaza commented 11 years ago

What is happening is that cells that have different text for their caption seem to be putting the TextLabel in front of the UITextField, covering it, which is why they appear blank. I have not found a way of making a recycled cell stop from making the text come to the front after the cell has returned, I suspect it is happening in a layout pass.

Since these are heavy weight objects anyways (we always create the UITextField), I have changed the code to cache the cell returned (so no dequeuing takes place).

I also updated the code, so it should work and adjust the entry line when orientation changes.